Recently, Watchman Monitoring completed its upgrade to Rails 4 and Ruby 2.1, as well as updated server binaries. We’d coded support for Emoji via extended Unicode with dependences on the new Rails, so it was time to make the jump.
When Unicode was first implemented in MySQL, 6 byte, rather than 7byte, encoding was used. 7byte encoding did not support extended characters such as Emoji. Thankfully, MySQL fixed this by releasing UTF8MB4, an encoding set that includes the extended set (albeit reducing the useable space slightly due to the extra byte). The testing we’d done converting the columns had been successful in our development environment, and no issues were found. Seems simple enough, right? Not quite.
Prior to deployment to the live environment, we rolled out the updates to our staging environment. Emoji were properly displaying, and machines with Emoji names were reporting. However, upon testing the e-mails sent through Postmark, we discovered an issue where emails were truncating after any Emoji character. We made the decision to work around it, and we quickly wrote a patch to convert the Emoji to their test representation for e-mails (e.g. :smile:). Simple, right? Well, still not quite.
Shortly after writing the conversion code, we noticed that non-Emoji were being converted as well (strings like “11” were being converted to :one:). After some investigation, we found that the gem we were using to do the conversion had a bug in their latest release. We ended up forking the gem and patching it to handle those strings correctly. At this point, we’re a few hours into what was going to be, at most, a one hour deployment.
Thankfully, minus a few human errors, the rest went off without a hitch after that. Emoji support was retained in our interface, and the e-mails were being sent with the converted Emoji. The rollout to production went smoothly, and we had zero downtime throughout the deployment and patching.
All in all, it’s the largest single update we’ve rolled out, and I’m proud of our team’s ability to quickly solve the challenges that arose.
(go figure: WordPress isn’t setup for Emoji by default)