January 26, 2020

Emojis on MovableType! 😎

Emojis are so ubiquitous today that it's hard to believe that they have been adopted by Unicode and started appearing in wide use only about 10 years ago. And I have gotten used to them as well and wasn't expecting at all when in the blog post draft instead of, say, 🧟‍♂️  I saw only four question marks. ????. That meant my MT5 install did not support emojis. I had some more fixin' to do. 😞

In particular:

  • I'd require a Perl version which supports Unicode, and preferably recent version, with up to date Unicode support. Fortunately, I have updated to Perl 5.26, and it supports Unicode 9.0. 🎉
  • MySQL database should be configured to use UTF-8... And that's where trouble starts, since apparently `utf8` does not mean what you think it means, and you have to use `utf8mb4` character set (and `utf8mb4_unicode_ci` collation) to make emojis specifically and newer Unicode in general work. 😒 Easiest way to change character encoding and collaction for the whole mt database for me was export, edit SQL file, and re-import process. It was also a good opportunity to do other updates, such as switch from MyISAM to InnoDB engine. ✨
  • Lastly, it seemed that MT4 itself was already supporting Unicode. Looks like that support was not 100% correct, but I was hoping it should be enough for my needs... Not quite, there was one more step: MT's database connection had to be now configured to use `utf8mb4` instead of `utf8`, and I've added `SQLSetNames 1` line to the `mt-config.cgi` file for the good measure.
  • While making all these changes, I've also noticed that MT4 setup might be in need of some hardening, and disabled some extra scripts.

Result? Complete success! 🚀

Posted by Vadim at January 26, 2020 2:05 PM | TrackBack
Post a comment

Remember personal info?