PHP json_encode json_decode UTF-8

前端 未结 10 853
温柔的废话
温柔的废话 2020-12-01 07:45

How can I save a json-encoded string with international characters to the databse and then parse the decoded string in the browser?



        
10条回答
  •  臣服心动
    2020-12-01 08:44

    This is an encoding issue. It looks like at some point, the data gets represented as ISO-8859-1.

    Every part of your process needs to be UTF-8 encoded.

    • The database connection

    • The database tables

    • Your PHP file (if you are using special characters inside that file as shown in your example above)

    • The content-type headers that you output

提交回复
热议问题