gemoji-parser icon indicating copy to clipboard operation
gemoji-parser copied to clipboard

Support for skin-colored emojis

Open joseramonc opened this issue 9 years ago • 1 comments

Is there an appropiate way to parse apple colored emojis?

I'm getting:

EmojiParser.tokenize("Test 👍🏿")
# => "Test :+1:\u{1F3FF}"
# Expected: "Test :+1::skin-tone:" or something like that

joseramonc avatar Jun 29 '15 17:06 joseramonc

Just coded an ugly monkey patch to prevent database errors if that can help someone reading this issue.

require 'gemoji'

module EmojiParser
  def self.tokenize(text)
    text = text.gsub(color_emoji_regex, '')
    parse_unicode(text) { |emoji| ":#{emoji.name}:" }
  end

  def self.color_emoji_regex
    reg = /((?:\u{1f3fb}|\u{1f3fc}|\u{1f3fd}|\u{1f3fe}|\u{1f3ff}?))/
  end
end

rdlh avatar Jul 04 '16 15:07 rdlh