特殊撇号打破JSON
问题描述:
[7671] => Sleaford Carre’s
是$ result中的元素
is an element in $result
$result= json_encode($result);
echo $result;
//outputs
"7671":null,
请注意,这不是普通的撇号(单引号)或反引号. 我什至无法在键盘上找到它.数据来自Latin-1表.
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.
我还注意到在构建数组时使用htmlentities将使数组中的字符串消失.我该怎么办??
I have also noticed that using htmlentities on building the array will dissapear the string from the array. What am I to do??
答
由于没有人实际写过答案,因此请阅读注释:)
As no-one has actually written an answer, read the comments:)
使用utf8_encode()然后使用json_encode(). –布莱恩
as the others have said, use utf8_encode() then json_encode(). – Brian