1. Cause Analysis:
When you save to the database! MySQL does not store Unicode characters:
MySQL is only supported from basic multi-lingual plane characters (0X0000-0XFFFF). Please try to store a synonym instead:)
Update: MySQL on 5.5.3 (which has not yet GA), supports supplemental characters if you use UTF8MB4 encoding.
When Json_encode Chinese, I will encode the characters into "uxxxx".
And in the database, "" is blocked, directly into the "uxxxx"
2. Problem solving:
Know what the reason is to solve the problem, you can choose other storage methods;
or the remedy. Further escape "" to ", to preserve" "
Our solutions:
1. Avoid json_encode convert Chinese to Unicode encoding.
PHP5.4 version, a new option has been added to JSON: Json_unescaped_unicode. With this option, the Chinese is not automatically encoded.
$test = Json_encode ("Shenzhen", Json_unescaped_unicode);
2. After urlencode,json_encode the Chinese text section, and then using the UrlDecode, it is also possible to ensure that the language is not converted to Unicode.
$test =urldecode (Json_encode (' Brief ' =>urlencode (' Introduction '), ' title ' =>urlencode (title)));
3. Further escape "" to "" to avoid Unicode as a special character removal by MySQL before "
http://www.bkjia.com/PHPjc/371391.html www.bkjia.com true http://www.bkjia.com/PHPjc/371391.html techarticle 1. Cause analysis: When storing to the database! MySQL does not store Unicode characters: MySQL is only supported from basic Multilingual Plane characters (00000-0XFFFF). Please try to store a synonym opposite ...