Special apostrophe breaks JSON

自古美人都是妖i 提交于 2019-12-24 06:57:27

问题


[7671] => Sleaford Carre’s

is an element in $result

$result=  json_encode($result);
echo $result;
//outputs
"7671":null,

Please note that this is not a normal apostrophe (single quote) or a back tick. I cant even find it on my keyboard. Data comes from a Latin-1 table.

I have also noticed that using htmlentities on building the array will dissapear the string from the array. What am I to do??


回答1:


As no-one has actually written an answer, read the comments:)

as the others have said, use utf8_encode() then json_encode(). – Brian



来源:https://stackoverflow.com/questions/19688409/special-apostrophe-breaks-json

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!