Chinese is NULL when arrays are converted in json format. & lt ;? Php $ json [{ZtdID: 100000, ZtdNo: 001 & nbsp;, ZtdName: Shop 1 & nbsp;, Address: Shop No. 01, YY Road, ZZ district, XX city & nbsp ;, remark:, AreaID: 01, ZtdTel: 0000-8888888. the Chinese character is NULL when the json Array is converted. Solution
$ Json = '[{"ZtdID": "100000", "ZtdNo": "001", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "Zhangsan" },{ "ZtdID": "100001", "ZtdNo": "002", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "Li San"}] ';
Var_dump (json_decode ($ json, true ));
?>
The output is NULL.
After careful consideration, it is a coding problem. how can this problem be solved?
------ Solution --------------------
Iconv ('gbk', 'utf-8', 'convert Chinese to json ');
PHP json does not support the gbk gb2312 format.
------ Solution --------------------
$ Json = '[{"ZtdID": "100000", "ZtdNo": "001", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "Zhangsan" },{ "ZtdID": "100001", "ZtdNo": "002", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "Li San"}] ';
Debug ($ json );
Debug (json_decode ($ json, true ));
------------------ The output is normal.
[{"ZtdID": "100000", "ZtdNo": "001", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "Zhangsan" },{ "ZtdID": "100001", "ZtdNo": "002", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "Li San"}]
Array
(
[0] => Array
(
[ZtdID] = & gt; 100000
[ZtdNo] => 001
[ZtdName] => Store 1
[Address] => shop 01, YY Road, ZZ district, XX city
[Remark] =>
[AreaID] => 01
[ZtdTel] = & gt; 0000-8888888
[ZtdContact] => John
)
[1] => Array
(
[ZtdID] = & gt; 100001
[ZtdNo] => 002
[ZtdName] => Store 1
[Address] => shop 01, YY Road, ZZ district, XX city
[Remark] =>
[AreaID] => 01
[ZtdTel] = & gt; 0000-8888888
[ZtdContact] => San Li
)
)
------ Solution --------------------
$ Json = '{"ZtdID": "100000", "ZtdNo": "001", "ZtdName": "Shop 1", "Address ": "Shop No. 01, YY Road, ZZ district, XX city", "Remark": "", "AreaID": "01", "ZtdTel": "0000-8888888 ", "ZtdContact": "James "}';