Fix utf8 and JSON issues resulting from MYSQL being weird

This commit is contained in:
2018-08-24 13:53:18 +02:00
parent 07c1a90845
commit d1612e2804
2 changed files with 13 additions and 2 deletions

View File

@@ -35,4 +35,15 @@ elseif ($_SERVER['REQUEST_METHOD'] === 'POST') {
}
}
echo json_encode($out);
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($out));