in a C++ software using the libmysqlclient, I am trying to insert a row into a table containing html-encoded characters such as é. The request looks like this:
INSERT INTO mytable ( field ) VALUES( 'Justificatif d\'achat numéro 1523641305' )
It fails with error:
Incorrect string value: '\xE9ro 15...' for column 'field' at row 1
If I copy my request such as, copy it into workbench and execute it, it works. But it is impossible to have it work from my code.
My column is in charset utf8 with default collation.
I connect to my DB using mysql_real_connect, and call "SET NAMES 'utf8'"
just after having performed the connection.
First edit: I have read the questions and answers from Inserting UTF-8 encoded string into UTF-8 encoded mysql table fails with "Incorrect string value", and tried to apply the suggested solutions, but it did not work for me. As far as I understand the problem, my issue is different since the character I try to insert is U+00E9 in Unicode, and therefore is only on 2 bytes. Also, I am able to insert it into my DB, just not from my C++ code.