utf8

c2bK: Comment Emojification

As part of my Couch to BlogK program (c2bK), I'm making some infrastructure improvements around here. This blog uses some home-rolled PHP, a handful of Perl scripts for snagging photos from other services, and love. I figured suffering the slings and arrows of a public commenting system would help me stay on task, but my old commenting system felt a bit dated. I knew there was only one thing that could bring my weblog comments into the Slack millennium: emoji.

I don't have research to back it up, but I'm fairly certain that kids these days don't even use text. They share pictures and write elaborate encoded messages with a set of pictograms that communicate with more verve than the stolid word. Who am I to fight against a tide of verve?

Once the decision was made, I thought it was just a matter of making sure my database was using a character set that could handle emojis and I'd be off to the races. Iñtërnâtiônàližætiøn is a solved problem! UTF-8 has solved everything! Well...

Using emoji on your phone is easy. Using emoji on your desktop is not as easy. And even though I'm bringing this website up-to-date for the kids who might not even know what a desktop is, I'd like our elders to be able to participate in the fun. Building my own emoji-selection contraption felt like a tall order, but I google stumbled on wdt-emoji-bundle by Nedim Arabacı which did most of the heavy lifting for me. He was inspired by the Slack emoji picker which translates emoji into a colon-delimited short name that can mingle easily with text.

That led me to Slack's own Cal Handerson's project emoji-data that is the rosetta stone of emoji. You see, different device manufacturers use different codepoints to represent the same glyph. So even if you're storing the incoming emoji characters correctly, not everyone would be able to see, for example, Down-Pointing Red Triangle on the other end. emoji-data does the work of saying that Android's arrow is here, Apple's arrow is there, and you don't need to just give up on people being able to emoji together.

(This doesn't even touch on the problem of different visual implementations across different emoji sets.)

Instead of storing the universal emoji characters, I opted to store the short name as plain text and then do a bit of translating on the other end. Another of Cal Henderson's projects, php-emoji made it easy for me to write some quick translation functions and then I really was off to the races! (No, I don't have emoji implemented for posts yet.)

Long story short: emojis are hard, this hand-coded blog now has a comment system with a Slack style emoji menu, support for emoji short code text, and a bridge to interface with the Snapchat generation thanks to folks like Cal and Nedim sharing some of their work in public.

And all of that means I'm on my way to blogK.