PHP json_decode cannot parse special question mark characters. json_decode question mark
When requesting information through other interfaces, some characters may occasionally occur. if the following conditions are met, json_decode will return null.
However, this situation is not generally caused by the overall encoding problem, because it is parsed using UTF-8 encoding.
In this case, both Chinese and English are used, but some blank characters cannot be recognized.
The observation of the system logic should be due to the fact that non-UTF-8 characters can be recognized when the characters are saved in the previous section, which is not affected in json_encode, this directly causes invalid characters when the interface obtains data.
Solution:
$ Return_data = mb_convert_encoding ($ return_data, "UTF-8", "UTF-8 ");
The characters returned through the curl request are forcibly encoded at one time. In this case, the original UTF-8 encoded text will not be affected, and UTF-8 unidentifiable characters will be forcibly parsed, after the characters are parsed, they will become English characters? ,
In this way, json_decode can be smoothly implemented.