There should return a number of results in my hand json type. But I can not output due to special characters. Example data in content array:
Alt�n Portakal Film Festivali sonu�land�.
(Problem: �
)
$JSON["today"]=array();
for ($i=0; $i < count($olay_tarih); $i++) {
$gelen["date"] = array();
$gelen["content"]=array();
array_push($gelen["date"], $olay_date[$i]);
array_push($gelen["content"], $olay_content[$i]);
array_push($JSON["today"], $gelen);
}
echo json_encode($JSON);
Change your code to:
header('Content-Type: application/json; charset=utf-8', true,200);
$JSON["today"]=array();
for ($i=0; $i < count($olay_tarih); $i++) {
$gelen["date"]=array();
$gelen["content"]=array();
array_push($gelen["date"], $olay_date[$i]);
array_push($gelen["content"], $olay_content[$i]);
array_push($JSON["today"], $gelen);
}
$JSON = array_map('utf8_encode', $JSON);
echo json_encode($JSON);
Adding UTF-8 headers will make the browser recognize any special characters for this setting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With