Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Emoji is Serious Business 👔

Emoji is Serious Business 👔

Discussing cross-platform issues that arise with emoji, and how you can suport emoji input and display in your application with minimum fuss. Along the way, addressing Ruby String encoding, Unicode, and the pains of managing user input.

Mark Wunsch

April 09, 2013
Tweet

More Decks by Mark Wunsch

Other Decks in Programming

Transcript

  1. http://www.theverge.com/2013/3/4/3966140/how-emoji-conquered-the-world The promise of digital communication — being able to

    stay in closer touch with people — was being offset by this accompanying increase in miscommunication
  2. OD(1) BSD General Commands Manual OD(1) NAME od -- octal,

    decimal, hex, ASCII dump SYNOPSIS od [-aBbcDdeFfHhIiLlOosvXx] [-A base] [-j skip] [-N length] [-t type] [[+]offset[.][Bb]] [file ...] DESCRIPTION The od utility is a filter which displays the specified files, or standard input if no files are specified, in a user specified format.
  3. mark:~ $ echo 'Hello, world' | od -cs 0000000 H

    e l l o , w o r l d \n 25928 27756 11375 30496 29295 25708 10 0000015
  4. irb(main):001:0> hello = %w( 25928 27756 11375 30496 29295 25708

    10 ).map(&:to_i) => [25928, 27756, 11375, 30496, 29295, 25708, 10] irb(main):002:0> hello.pack("s*") => "Hello, world\n\x00" Array#pack
  5. mark:~ $ echo 'Hello, world' | od -c -txC 0000000

    H e l l o , w o r l d \n 48 65 6c 6c 6f 2c 20 77 6f 72 6c 64 0a 0000015
  6. irb(main):001:0> hex = %w( 48 65 6c 6c 6f 2c

    20 77 6f 72 6c 64 0a ) => ["48", "65", "6c", "6c", "6f", "2c", "20", "77", "6f", "72", "6c", "64", "0a"] irb(main):002:0> hex.map(&:hex).pack("U*") => "Hello, world\n" Array#pack
  7. irb(main):001:0> hello = "Hello, world\n" => "Hello, world\n" irb(main):002:0> hello.unpack("U*").map

    {|fixnum| fixnum.to_s(16) } => ["48", "65", "6c", "6c", "6f", "2c", "20", "77", "6f", "72", "6c", "64", "a"] String#unpack
  8. mark:~ $ echo 'Hello, ' | od -c -txC 0000000

    H e l l o , 360 237 214 216 \n 48 65 6c 6c 6f 2c 20 f0 9f 8c 8e 0a 0000014
  9. irb(main):001:0> emoji = %w( 48 65 6c 6c 6f 2c

    20 f0 9f 8c 8e 0a ) => ["48", "65", "6c", "6c", "6f", "2c", "20", "f0", "9f", "8c", "8e", "0a"] irb(main):002:0> emoji.map(&:hex).pack("U*") => "Hello, ð\u009F\u008C\u008E\n"
  10. irb(main):001:0> emoji = "Hello, \u{1F30E}" => "Hello, " irb(main):002:0> emoji.codepoints.map

    {|int| int.to_s(16) } => ["48", "65", "6c", "6c", "6f", "2c", "20", "1f30e"] irb(main):003:0> emoji.codepoints.to_a.pack("U*") => "Hello, " String#codepoints
  11. puts Rumoji.encode("Lack of cross-device emoji support makes me ") #=>

    Lack of cross-device emoji support makes me :sob:
  12. mark:~ $ echo "But Rumoji makes encoding issues a :joy:"

    | rumoji But Rumoji makes encoding issues a
  13. • https://gist.github.com/ mwunsch/4710561 • https://github.com/tenderlove/ minitest-emoji • https://gist.github.com/ mwunsch/4691580 •

    http://zachholman.com/posts/ abusing-emoji/ • http://notes.torrez.org/2013/04/ put-a-burger-in-your-shell.html Extras