I'm selecting some data from database and encoding them as json, but I've got a problem with czech signs like
á,í,ř,č,ž...
My file is in utf-8 encoding, my database is also in utf-8 encoding, I've set header to utf-8 encoding as well. What else should I do please?
My code:
header('Content-Type: text/html; charset=utf-8');
while($tmprow = mysqli_fetch_array($result)) {
$row['user'] = mb_convert_encoding($tmprow['user'], "UTF-8", "auto");
$row['package'] = mb_convert_encoding($tmprow['package'], "UTF-8", "auto");
$row['url'] = mb_convert_encoding($tmprow['url'], "UTF-8", "auto");
$row['rating'] = mb_convert_encoding($tmprow['rating'], "UTF-8", "auto");
array_push($response, $row);
}
$json = json_encode($response, JSON_UNESCAPED_UNICODE);
if(!$json) {
echo "error";
}
and part of the printed json: "package":"zv???tkanalouce"
EDIT: Without mb_convert_encoding() function the printed string is empty and "error" is printed.