I'm trying to add a new record to my MySQL table but I'm getting the following error:
An exception occurred while executing 'INSERT INTO team_mate (id, first_name, cached_sessions_count, created_at, updated_at)
VALUES (?, ?, ?, ?, ?)'
with params ["\xb6\xc4\xcf\x4e\x19\xcc\x43\x04\x82\x63\x79\x31\xec\x21\x5e\x66", "\x3f\x89\x6c\x69\x73\x65", 0, "2019-10-28 20:11:42", "2019-10-28 20:11:42"]:
SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\x89lise' for column 'first_name' at row 1
What is very weird is that inserting a new record named Élise doesn't work (and produces this error), but inserting aÉlise does work, in fact the error only happens when the first byte or first character of the field contains an accentued character.
Setup :
- I use MySQL 8.0.18
- I connect to my database using charset
utf8mb4
- The table
team_mate
has collationutf8mb4_unicode_ci
- The field
first_name
in my table has collationutf8mb4_unicode_ci
The result of show variables like '%colla%';
performed from the connection:
collation_connection = utf8mb4_unicode_ci
collation_server = utf8mb4_unicode_ci
collation_database = utf8mb4_unicode_ci
The result of show variables like '%charac%';
performed from the connection:
character_set_client = utf8mb4
character_set_connection = utf8mb4
character_set_database = utf8mb4
character_set_filesystem = binary
character_set_results = utf8mb4
character_set_server = utf8mb4
character_set_system = utf8
Thanks!