Values in UTF-8 being encoded as NULL in JSON

后端 未结 5 2153
鱼传尺愫
鱼传尺愫 2021-02-08 19:39

I have a set of keywords that are passed through via JSON from a DB (encoded UTF-8), some of which may have special characters like é, è, ç, etc. This is used as part of an auto

5条回答
  •  故里飘歌
    2021-02-08 20:29

    My solution to encode utf8 data was :

    $jsonArray = addslashes(json_encode($array, JSON_FORCE_OBJECT|JSON_UNESCAPED_UNICODE))
    

提交回复
热议问题