PHP generated JSON data from MySQL, Chinese has related problems
Source: Internet
Author: User
PHP generated JSON data from MySQL, Chinese is problematic.
MySQL is UTF8 code, json.php is UTF8 code, in the database, the Direct query table, the Chinese can be displayed correctly.
In the PHP program,
mysql_query ("Set names UTF8"); Use this to set the encoding.
UrlDecode (Json_encode ($newData)) This is the generation of JSON.
But the Chinese do not come out ah, the result is as follows:
------Solution--------------------
The Chinese JSON is originally a Unicode-encoded string representation.
------Solution--------------------
Baidu Search the first article, you can see the answer.
JSON Chinese code phpnewnew site:csdn.net
------Solution--------------------
Dizzy, I Google Json_decode site:w3school.com.cn unexpectedly did not search ...
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service