I'm trying to echo a json_response with unicode characters using the following code:
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;
}
used like this:
echo json_encode(utf8ize($response));
The problem with this is that some characters are encoded properly and other characters like ć
and ś
are sent as question marks as seen in the below image:
I'm not sure how to fix this.