简体   繁体   中英

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.

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.

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM