3 ms·
Only recently did MySQL start defaulting to proper Unicode support, and it's still not the default everywhere in the stack nor on all OSes. I did a mysqldump/r
by marcan_42 5y ago
Only recently did MySQL start defaulting to proper Unicode support, and it's still not the default everywhere in the stack nor on all OSes.
I did a mysqldump/restore last year with default options and it ate all emoji in the database. This is because MySQL's "utf-8" isn't real UTF-8, it's "utf8mb3" which does not support non-BMP characters. You have to explicitly ask for utf8mb4 to get sane behavior. In my case the database was configured correctly, but mysqldump still defaulted to utf8mb3. I found out that day all my database backups had been subtly corrupted forever.
This is one reason I use PostgreSQL everywhere I can get away with it. It has infinitely saner tooling. But WordPress insists on being married to MySQL...
- bombcar 5y agoThe easiest test for utf8mb4 is try to round-trip a emoji smiley. UTF real handles it, the fake version doesn’t.
- KronisLV 5y ago> You have to explicitly ask for utf8mb4 to get sane behavior. Here's more information about the difference between utf8 and utfmb4 in MySQL, in case anyone is wondering: https://stackoverflow.com/a/30074553 https://stackoverflow.com/a/30074553 I'd say that in most modern circumstances you probably should just go with utfmb4, unless you have a good reason for doing otherwise (apart from only ever needing to use the BMP, or having some odd storage restrictions). Can anyone come up with an actual good reason to use utf8mb3?