简体   繁体   中英

Fetching hindi text from database mysql

i am saving the hindi text into the database. It is saving in db as "हिन्डि".

But while fetching i am not able to fetch the same hindi text instead it is fetching the above mentioned uniciode characters

First check for UTF8 compatibility with below query. If it supports you should see the output as “Character_set_system”| “UTF8″

SHOW VARIABLES LIKE ‘character_set_system’;

if its not run below query to change it

ALTER TABLE yourtable MODIFY text VARCHAR(200) CHARACTER SET UTF8;

Then execute following query before inserting into the table:

mysql_query('SET character_set_results=utf8');        
mysql_query('SET names=utf8');        
mysql_query('SET character_set_client=utf8');        
mysql_query('SET character_set_connection=utf8');
mysql_query('SET collation_connection=utf8_general_ci'); 

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