I have issues with unicode characters returning a string null within an array. This array is creating in PHP and echoed which json_encode. The problem exists within "name".
The initial object looks like:
[{"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"}]
I have used a function from another question which looks like this:
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));
This now returns a string (within the array) which looks like:
[{"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"}]
Now I am having trouble converting this to a html entity. It will also need to apply to any other unicode characters that may appear in the database. Any help?
Many thanks!
UPDATE: Just doesn't seem to work with em dash/en dash. I haven't gone through all of the unicode characters though.