Explorer
Explorer

Reputation: 177

How to insert Hindi Fonts in Mysql using Codeigniter Framework

I want to Insert Hindi fonts to Mysql database table using PHP CodeIgniter Framework.

I have altered table columns to CHARSET utf8 and also collation to utf8_general_ci. But still Hindi fonts are inserting as garbage characters.

I also tried to describe mysql_set_charset('utf8'); before insert Query but the result is the same.

Upvotes: 1

Views: 3004

Answers (2)

Nagama Inamdar
Nagama Inamdar

Reputation: 2857

As suggested add this meta tag in the header of views (HTML) markups header.

 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

And as your question states change the collation of your field to utf8_general_ci. This solved my problem totally.

Hope it will yours too.

Upvotes: 1

Jigar Jain
Jigar Jain

Reputation: 1447

I had similar problem with accented characters and I had tried the same thing you did. But additionally I had also used this function

htmlentities($data, ENT_QUOTES, "UTF-8")

Pass your data through above function before inserting it in DB.

Also while showing the same data to the user, pass it via

html_entity_decode($data, ENT_QUOTES, "UTF-8")

It worked for me, and I hope it works for you too :)

Upvotes: 0

Related Questions