php – 1ª if it returns 1 \ u00aa when I insert no json


When I insert in JSON with codeigniter, when I transform it to string it becomes 1\u00aa .

$t[0]["teste"] = "1ª";
$data[0]["algo"] = $t;


Normal. PHP uses the \u quatro-dígitos-hex format to escape special (non-ASCII) characters. This is valid JSON, see

If you really want to avoid the escape, you can use the JSON_UNESCAPED_UNICODE option:

php > // com a flag:
php > print(json_encode('ºªáéíóú',JSON_UNESCAPED_UNICODE));

php > // sem a flag:
php > print(json_encode('ºªáéíóú'));
Scroll to Top