I have a table in a mysql database with the charset set to utf8 and collate utf8_general_ci, in my php project I am performing insertions, however, data containing accent are inserted "encoded" Ex: word Inteligência when sended to database is converted to Inteligu00eancia
Asked
Active
Viewed 55 times
1
-
1Did you read this **[very informative q/a about UTF8, right here on SO!!!](https://stackoverflow.com/questions/279170/utf-8-all-the-way-through)** and review your solution. A must read, really. – YvesLeBorg Jul 19 '18 at 14:54
-
Yeah, i read question, but not solve my problem, the problem persists... – Vinicius Guerato Jul 19 '18 at 17:01
-
@YvesLeBorg - nice try, but it does not cover Unicode encodings. with `\u...`. – Rick James Jul 19 '18 at 21:25
-
@RickJames true true true. So true in fact, i forbid straight use of json_encode from some of my stack in favour of my own 'unicode' friendly version. Done that so long ago i f'got about it ! – YvesLeBorg Jul 19 '18 at 23:16
1 Answers
2
No, "Utf8 all the way" does not address this case.
You have \u00ea
, the Unicode representation. You want hex C3AA
.
One place that generates the Unicode is PHP's json_encode; add an extra parameter:
$t = json_encode($s, JSON_UNESCAPED_UNICODE);
(The backslash vanished due to it being an escape character.)

Rick James
- 135,179
- 13
- 127
- 222