This is a tool to convert Emoji Unicode codepoints into the human-friendly codes used by and back again.

Why would you want to do this? Read this blog post:


Do not store emoji unicodes in your database. Store the human-friendly code and support the emoji-cheat-sheet.

By doing this, you can ensure that users across devices can see the author’s intention. You can always show users an image, but you can’t show them a range of characters their system does not support.


# Takes a String, transforms Emoji into cheat-sheet codes

# Does the reverse

Rumoji.encode_io(read, write)
# For an IO pipe (a read stream, and a write stream), transform Emoji from the
# read end, and write the cheat-sheet codes on the write end.

Rumoji.decode_io(read, write)
# Same thing but in reverse!


gem install rumoji

Note that rumoji has only been tested in Ruby 1.9!!!

Some examples:

puts Rumoji.encode("Lack of cross-device emoji support makes me 😭")

#=> Lack of cross-device emoji support makes me :sob:

Here's a fun file:

Rumoji.decode_io($stdin, $stdout)

On the command line

echo "But Rumoji makes encoding issues a :joy:" | ruby ./funfile.rb
#=> But Rumoji makes encoding issues a 😂

Implement the emoji codes from using a tool like gemoji along with Rumoji, and you'll easily be able to transform user input with raw emoji unicode into images you can show to all users.

Currently, Rumoji only supports the People and Nature characters in emoji-cheat-sheet, but that will change!

Having trouble discerning what's happening in this README? You might be on a device with NO emoji support! All the more reason to use Rumoji. Transcode the raw unicode into something users can understand across devices!


Copyright (c) 2009 - 2012 Mark Wunsch. Licensed under the MIT License.