The code is as follows:
\ U5c0f \ u533a \ u7eff \ u5316 \ u5f88 \ Alibaba \ u9519 |||\ Alibaba \ u4ec0 \ u4e48 \ u65f6 \ u5019 \ Alibaba \ u7684 ||| \ Users \ Users \ u4ea4 \ u623f \ u4e86 | \ u548c \ u683c \ u6797 \ u4e91 \ u5885 \ u79bb \ u5f97 \ Users \ users | \ u5730 \ Users
Can anyone understand the above code? I guess no one is there. I know it's json, so take a piece and test it.
The code is as follows: |
Copy code |
Echo json_decode ('u683c \ u8fd8 \ u4e0d \ u9519 '); |
No input is found. Later we thought this is not a standard json. We can use an array to convert it.
The code is as follows: |
Copy code |
$ Array = array ('u683c \ u8fd8 \ u4e0d \ u9519 '); Echo json_encode ($ array ); The result is: ["U683c \ u8fd8 \ u4e0d \ u9519"] |
This is not data in standard json format. I will parse it later.
The code is as follows: |
Copy code |
$ Array = json_decode ('["\ u4e8c \ u671f \ u4ec0 \ u4e48 \ u65f6 \ u5019 \ u4ea4 \ u623f \ u7684"]'); Print_r ($ array ); ( [0] => bang ??? {€ ?? Why ?? Hey? Cross ?? ) |
It's garbled. I guess this is Encoding. I know that the json conversion encoding is uft8, and my page is gbk. I found the iconv function at that time.
The code is as follows: |
Copy code |
$ Array = json_decode ('["\ u4e8c \ u671f \ u4ec0 \ u4e48 \ u65f6 \ u5019 \ u4ea4 \ u623f \ u7684"]'); Echo iconv ('utf-8', 'gbk', $ array [0]); |
The result is:
When will the second phase be handed over?
In this way, garbled characters are successfully converted into Chinese characters. Please give it a try.
Site original tutorial: Reprinted with the source of http://www.111cn.net