PHP JSON ENCODE - Уродство UTF -8 PHP/CodeIgniterPhp

Кемеровские программисты php общаются здесь
Anonymous
PHP JSON ENCODE - Уродство UTF -8 PHP/CodeIgniter

Сообщение Anonymous »

Я получаю следующую ошибку: < /p>

Код: Выделить всё

Fatal error[/b]:  Uncaught CodeIgniter\Format\Exceptions\FormatException:
Falha ao analisar a string json, erro: "Malformed UTF-8 characters, possibly incorrectly encoded".
in C:\xampp\htdocs\sysbio\vendor\codeigniter4\framework\system\Format\JSONFormatter.php:41
< /code>
Ошибка возникает в следующей части контроллера: < /p>
 public function ajax_list($status = 'all')
{
$retorno = [
'status' => false,
'message' => 'Nenhum status válido foi informado para a busca de lotes.'
];

if (in_array($status, ['all', 'validos', 'expirados'])) {
$codpro = $this->request->getVar('codpro', FILTER_SANITIZE_STRING);

if (!empty($codpro)) {
$retorno = [
'status' => true,
'message' => null,
'lotes' => $this->E210dlsModel->getLotes($this->codEmpresa, $codpro, $status)
];
} else {
$retorno['message'] = 'Nenhum lote encontrado para este produto.';
}
}

echo json_encode($retorno, JSON_UNESCAPED_UNICODE);
}
In the part where it was supposed to fetch the 'batches' in the model search within the getLotes method, the issue is that I've tried everything to fix this problem and I can't find any solution...

My E210dlsModel:

Код: Выделить всё

 

Подробнее здесь: [url]https://stackoverflow.com/questions/79703762/php-json-encode-malformed-utf-8-php-codeigniter[/url]

Вернуться в «Php»