Hallo all, I have a MySQL database with the following settings:
MySQL charset: UTF-8 Unicode (utf8)
MySQL connection collation: utf8_unicode_ci
i 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 can be shown correctly. But if i run SQL through a php file, all chinese characters are shown wrongly. Here is the php file:
<?php
header("Content-Type: text/html; charset=utf8_general_ci");
mysql_connect("116.123.163.73","xxdd_f1","xxdd123"); // host, username, password
mysql_select_db("xxdd");
mysql_query("SET names 'utf8_general_ci'");
$q=mysql_query("SELECT softtitle
FROM dede_ext
LIMIT 0 , 30");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close();
?>
What is wrong here? What should i do to fix this problem? Thank you very much!