Good Day… for all and many thanks in advance
i got a simple rest api … but when i try do response with json all utf-8 content are replaced.
The partial code
(...)
if ($v->passes()) {
$result = $this->db->connection()->select("CALL getPoints();"));
$data = json_decode(json_encode($result, JSON_UNESCAPED_UNICODE | JSON_NUMERIC_CHECK ), true);
} else {
$data = [
'msg' => APP_MSG_ERROR_NOT_DATA,
'error' => true
];
}
print_r($data);
return $response->withHeader('Content-Type', 'application/json')->withStatus(200)->withJson($data);
//$response = $this->jsonRender->render($response, 200, $data);
//return $response;
The Result
If i print_r the array $data all the content show as well formated and encoded but when i use jsonRender or withJson it converts to Unicode
i think i miss something …