How to handle null when passing Chinese characters in json

Source: Internet
Author: User
If nullecho is transmitted in json, it will be normally displayed if it is a letter. if the Chinese character is null, what should I do? My default encoding is gb2312. it is easy to use a conversion function to convert to UTF-8. However, the data retrieved from the database cannot be used. the default encoding of the database is l json, and the Chinese character is transmitted. the display is null.
If echo is a letter, it will be displayed normally. if the Chinese character is null, what should we do? My default encoding is gb2312. it is easy to use a conversion function to convert it to UTF-8. However, the data retrieved from the database will not work. the default encoding in the database is latin1. how should I deal with this problem?

------ Solution --------------------
I also encountered this problem two days ago. I used Wamp 5.0.
Solution:
When the database is created, select utf8_general_ci for the "sorting" option.
When creating various tables, the "sorting" attribute of each record should also be set to utf8_general_ci.

The problem is solved!
------ Solution --------------------
Pick me up
------ Solution --------------------
What is mysql_set_charset () used? I don't understand!

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.