When using PHP json_encode to handle Chinese, Chinese will be encoded, become unreadable, similar to the "\u***" format, if you want Chinese characters do not transcode, here are three ways
1. Upgrade PHP, in PHP5.4, this problem finally resolved, JSON added an option: Json_unescaped_unicode, so the name Incredibles, that is, JSON do not encode Unicode.<?phpecho Json_encode ("Chinese", json_unescaped_unicode);//"Chinese" 2. UrlEncode the characters first and then use the Json_encode,json_encode again after using the UrlDecode to decode, In this way, the Chinese characters in the encoded JSON array will not appear Unicode encoded. $array = Array (' Test ' =>urlencode ("I Am Test"), $array = Json_encode ($array); Echo UrlDecode ($array);//{"test": "I am a Test"} 3. Decode the Unicode code and decode the function as follows: function Decodeunicode ($str) { return Preg_replace_callback ('/\\\\u ([0-9a-f]{4})/I ', create_function ( ' $matches ', ' Return mb_convert_encoding (Pack ("h*", $matches [1]), "UTF-8", "Ucs-2be") ; ' ), $str);}
Http://www.cnblogs.com/sink_cup/archive/2011/05/28/php_json_encode_unicode_decode.html
Http://www.veryhuo.com/a/view/35112.html
Http://www.alixixi.com/program/a/2011112776664.shtml
Solve Json_encode Chinese Unicode transcoding problem