I am working on json array but Turkish characters change with strange characters. For example:
- ı -> ı, sometimes ý (it is too weird)
- ü -> ö,
- İ -> ý
...
What I tried?
header('content-type: application/json; charset=utf-8');
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
iconv("ISO-8859-1", "UTF-8",$str)
I tried seperately all of them but didn't solve the problem. How can I fix this? Here is my code:
foreach($html->find('table//tbody//tr//td') as $element) {
$elm = strip_tags($element->innertext);
//echo $str."<br>";
if($str != " "){
$tmp[] = iconv("ISO-8859-1", "UTF-8",$str);
} else {
$lessons["lesson"][] = $tmp;
unset($tmp);
$temp = array();
}
}
$json = json_encode($lessons,JSON_UNESCAPED_UNICODE);
print_r($json);