Home > Article > Backend Development > In a multi-coding environment, what format should be used for php and js data transmission?
Currently, there are various encodings on the PHP side, including gbk, utf-8, big5, etc.
Now js needs to get the data from the server. If you use json format,
json_encode will return false if there is Chinese in the big5 encoding environment. Of course, I can use recursion to transcode the Chinese one by one and then re-json, but this does not feel like the best solution. Every time I go through such a set of transcoding, the performance will be reduced. affected.
I would like to ask if there are any other options? If not, you can only use this
Currently, there are various encodings on the PHP side, including gbk, utf-8, big5, etc.
Now js needs to get the data from the server. If you use json format,
json_encode will return false if there is Chinese in the big5 encoding environment. Of course, I can use recursion to transcode the Chinese one by one and then re-json, but this does not feel like the best solution. Every time I go through such a set of transcoding, the performance will be reduced. affected.
I would like to ask if there are any other options? If not, you can only use this
utf8 is the most reliable
Uniformly encode utf-8 unified format json on all ends