Mysql:
PHP files are as follows:
Header ("content-type:text/html; Charset=utf-8 ");
$index = 0;
$con = mysql_connect ("localhost", "root", "");
if (! $con)
{
Die (' Could not connect: '. Mysql_error ());
}
mysql_select_db ("Test", $con);
mysql_query ("Set names ' UTF8 '");
mysql_query ("Set Character_set_client=utf8");
mysql_query ("Set Character_set_results=utf8");
$result = mysql_query ("SELECT * from Test_list
Limit 0,4 ");
while ($row = Mysql_fetch_array ($result))
{
$load _crouse_array[$index] = Array (
' subject_id ' = $row [' subject_id '],
' Subject_title ' = $row [' Subject_title '],
' Subject_url ' = $row [' Subject_url '],
' Subject_belong ' = $row [' Subject_belong '],
' Creat_time ' = $row [' Creat_time ']
);
$index + +;
}
mysql_query ("INSERT into ' test ') ' test_list ' (' subject_id ', ' subject_title ', ' subject_url ', ' subject_belong ', ' Creat_ Time ') VALUES (' 100005 ', ' Test text ', ' Test_url ', ' excel_crous ', ' 2014-08-10 ');
Echo Json_encode ($load _crouse_array);
echo "Test Chinese Chinese";
?>
The result of the final output:
Also inserted records in the database in the Chinese part is also displayed as????.
I use eclipse programming to this issue, and then directly using text editing software notepad++ the same problem. Environment for Windows7,xmapp, use Chrome browser.
Reply to discussion (solution)
Please help the great god of the forum to see where the problem arises. Why Chinese has been output garbled. My little brother is here humbly.
This is not garbled this is you use JSON encryption, you want to check the words in the output and then decrypt it.
You this $load_crouse_array array after json_encode processing data, not what garbled, but Chinese is processed by Unicode.
Output Print_r ($load _crouse_array); This will know if it's garbled.
You this $load_crouse_array array after json_encode processing data, not what garbled, but Chinese is processed by Unicode.
Output Print_r ($load _crouse_array); This will know if it's garbled.
Thank you for your help.
This is not garbled this is you use JSON encryption, you want to check the words in the output and then decrypt it.
Also thank you.
Knot paste