我遇到了unicode字符在数组中返回字符串null的问题。这个数组是用PHP创建的,并且回显了哪个json_encode。问题存在于" name"。
中初始对象如下:
[{"ID":"147","First Name":"Tom","Last Name":"Bishai","Registered Table Number":"34","Email Address":"tombishai@gmail.com","Phone Number":"07921130704","Amount":"800","MadeFrom":"34","Type of Transaction":"bid","Number":"22","name":null,"Gift Aid":"Yes","PIN":"1261"}]
我使用了另一个问题的函数,如下所示:
function utf8ize($d) {
if(is_array($d)) {
foreach($d as $k => $v) {
$d[$k] = utf8ize($v);
}
} else if(is_string($d)) {
return utf8_encode($d);
}
return $d;
}
echo json_encode(utf8ize($arr));
现在返回一个字符串(在数组中),如下所示:
[{"ID":"147","First Name":"Tom","Last Name":"Bishai","Registered Table Number":"34","Email Address":"tombishai@gmail.com","Phone Number":"07921130704","Amount":"800","MadeFrom":"34","Type of Transaction":"bid","Number":"22","name":"JOAN MIRO \u0096 COMPOSITION IX","Gift Aid":"Yes","PIN":"1261"}]
现在我无法将其转换为html实体。它还需要应用于可能出现在数据库中的任何其他unicode字符。有什么帮助吗?
非常感谢!
更新 似乎没有使用em dash / en dash。我虽然没有通过所有的unicode角色。