Reading json. The file starts with 65279 and starts with json65279.
The loading of json files fails until today. Only ASCII encoding formats can be loaded. Because they are Chinese, they cannot be loaded in ASCII format, later, my colleague found that the first character of json is encoded as 65279. Later, Baidu gave it a bit because I edited the json file with the bom header.
The solution on the Internet is to use editplus or ultraedit software to operate to save as a UTF-8 on the line, as shown below:
1. Use editplus to remove the BOM Header
After the editor is adjusted to the UTF8 encoding format, a hidden character (BOM) is added before the saved file, which is used by the editor to identify whether the file is UTF-8 encoded.
Run Editplus, click the tool, select preference, select the file, select the UTF-8 ID alWays Delete the signature, and then the PHP file after editing and saving the PHP file is without BOM.
2. Use ultraedit to remove the BOM Header
After opening the file, select from the encoding format of the Save As option (UTF-8 without BOM header), OK
However, my colleague's method is to judge whether the first encoding is 65279 when reading json, and then delete the encoding.
If (int) (json [0]) = 65279) {json = json. Substring (1 );}