Hannah Vernon
I'm attempting to insert some UTF-8 data into MySQL on dbfiddle.uk
<>https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=06360f8df19c3b5fce07698c59e3f847
I've tried various methods of formatting the string, however I invariably get an error along these lines:
> Incorrect string value: '\xF0\x9F\x98\xB2' for column 'v' at row 1
How do I get dbfiddle to accept a UTF-8-encoded string?
Top Answer
Paul White
`utf8` in MySQL is a synonym for `utf8mb3`, which encodes to a **maximum of three bytes**. You cannot encode the 😲 character in three bytes of UTF8.
The example given works using the sensible db<>fiddle default of `utf8mb4` (allowing the full range of up to four bytes):
<>https://dbfiddle.uk/?rdbms=mysql_8.0&fiddle=a622d05926f92766b7f870398bdd6481