Why is Chinese characters encoded in json stored in the Mysql database garbled?
Source: Internet
Author: User
Why is garbled Chinese characters that store json codes to Mysql databases? The json code is as follows: "\ u6768 \ u6865 \ u6e56 \ u5927 \ u9053 \ u7a0b \ u6768 \ u6e7e", but after Mysql is stored, it becomes "success ", "\" does not store json-encoded Chinese characters in the Mysql database. why?
The json code is as follows: "\ u6768 \ u6865 \ u6e56 \ u5927 \ u9053 \ u7a0b \ u6768 \ u6e7e ",
However, the Mysql storage becomes: "u6768u6865u6e56u5927u9053u7a0bu6768u6e7e ",
The "\" is missing. what is the cause of this situation? how can this problem be solved ......
Mysql json shared:
------ Solution --------------------
\ Value escape character, so it must be escaped during warehouse receiving
Addslashes ("\ u6768 \ u6865 \ u6e56 \ u5927 \ u9053 \ u7a0b \ u6768 \ u6e7e ")
------ Solution --------------------
We recommend that you use serialize () to serialize and store it again. of course, you can also store json strings.
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