Thursday, August 1, 2013

php page cannot display Chinese character from mysql database

Today, I setup a mysql database with collation : utf8_general_ci. I input Chinese character from web page with meta tag : charset=utf-8".  When I retrieved these records, they were shown as "???".  After studying, I found that I need the following line :

mysql_query('SET character_set_results=utf8'); 


before  

$result = mysql_query($query);

I hope this information is useful for those who are developing web page with Chinese characters records in mysql.

No comments:

Post a Comment