Convert emoji and codepoints each other in Ruby

twitter logo github logo ・1 min read

The tips below are what I've learned while implementing a gem, github_reactions, to summarize reactions on GitHub issues and pull requests.

Get codepoints from emoji

=> [128077]

=> [128077]

# Convert to hexadecimal
"πŸ‘".each_codepoint.map {|n| n.to_s(16) }
=> ["1f44d"]

Get emoji from codepoints

=> "πŸ‘"

=> "πŸ‘"

=> "πŸ‘"
twitter logo DISCUSS
Classic DEV Post from Nov 12 '19

Feeling excluded and sad for not getting positive feedback - How should I react?

Masato Ohba profile image
Software Engineer