特殊撇号打破JSON [英] Special apostrophe breaks JSON
本文介绍了特殊撇号打破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
这篇关于特殊撇号打破JSON的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文