Issue with Chinese characters, PHP and MySQL

ePirate

New Member
I have a MySQL database with the following settings:
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_unicode_ciI have a table with a column named "softtitle", this column is coded in utf8_general_ci. The entries of this column contain Chinese characters. If I run SQL through the PHPMyAdmin Control pane, the Chinese characters are shown correctly. But if I run SQL through a PHP file, all Chinese characters are shown wrongly. Here is the PHP file:\[code\]<?phpheader("Content-Type: text/html; charset=utf8_general_ci"); mysql_connect("116.123.163.73","xxdd_f1","xxdd123"); // host, username, passwordmysql_select_db("xxdd");mysql_query("SET names 'utf8_general_ci'"); $q = mysql_query("SELECT softtitleFROM dede_extLIMIT 0 , 30");while($e = mysql_fetch_assoc($q)) $output[] = $e;print(json_encode($output));mysql_close();?>\[/code\]What is wrong here? What should I do to fix this problem? Thank you very much!
 
Back
Top