WordPress and UTF-8

tl;dr Thanks to @GaryPendergast I now switched from latin1 to utf8mb4.

Well f*ck me but I really didn’t take care about my blog at all any more. Checked the logs and an occasional error about emojis and the database showed up. On investigation I found out that the database was still running on MYISAM and latin1. WordPress never updated this during upgrade (despite my DB having support for this for ages). My website moved a lot and existed even before switching to WordPress in 2004 so it’s sort of a miracle that it’s still working anyway. Unlike Geocities and the likes I mean 😉

PHP message: WordPress database error Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8mb4_unicode_ci,COERCIBLE) for operation [...]

Fixed by running this SQL on all of my tables:

ALTER TABLE wp_posts ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
ALTER TABLE wp_posts CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

WordPress and UTF-8 by Gary (pento.net)

Update: WordPress 4.2 has full UTF-8 support! There’s no need to upgrade manually any more. For many years, MySQL had only supported a small part of UTF-8, a section commonly referred to as plane 0, the “Basic Multilingual Plane”, or the BMP. The UTF-8 spec is divided into “planes“, and ...