Fix utf8 and JSON issues resulting from MYSQL being weird
This commit is contained in:
@@ -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));
|
||||
|
Reference in New Issue
Block a user