How to get json_encode() to work with ISO-8859-1 (åäö)

前端 未结 8 966
礼貌的吻别
礼貌的吻别 2021-01-11 15:58

json_encode() wont work for me when I\'m using åäö. Why? And how can I get it to work?

The php:

echo json_encode($arr);
         


        
8条回答
  •  醉话见心
    2021-01-11 16:41

    As Greg mentioned, I had to encode åäö to UTF-8. But I did't use iconv or mbstring. When I utf8_encode() all values before putting the values to the array the problem was solved.

提交回复
热议问题