json_encode problems with utf8 [closed]

2019-03-07 06:54发布

Im having a MySQL db with some tables, all encoded in utf8_general_ci. I'm requesting with mysqli and returns an array.

If i do print_r($my_db_answer); i get åäö working like

Array
(
    [hi] => hej
    [hello] => hallå
)

if i do echo json_encode($my_db_answer); i get all the strings not containing åäö correct and null on the strings containing these values, like this:

{"hi":"hej","hello":"hall\u00e5"}

Regarding to php manual json_encode only works with utf8, so what's the problem here?

1条回答
放我归山
2楼-- · 2019-03-07 07:14

Never mind...

(I was cheking the json in the client before i decoded the json)

查看更多
登录 后发表回答