GithubHelp home page GithubHelp logo

mwunsch / rumoji Goto Github PK

View Code? Open in Web Editor NEW
182.0 182.0 71.0 122 KB

Encode and decode emoji unicode characters into emoji-cheat-sheet form.

Home Page: http://mwunsch.tumblr.com/post/34721548842/we-need-to-talk-about-emoji

License: MIT License

Ruby 100.00%

rumoji's People

Contributors

bgentry avatar cantino avatar chrismaximin avatar crice88 avatar eyalkenig avatar kindjar avatar mjnguyennz avatar mwunsch avatar remi avatar tiff avatar timleers avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rumoji's Issues

Variation selectors not stripped?

I noticed that "relaxed" emoji (☺️) on Yosemite is not stripped correctly with rumoji due to a variation selector that Apple added to the character. Hex representation of rumoji encoded string that contains a single "relaxed" emoji therefore looks like this:

http://cl.ly/image/2N1j33442e2u

Error handling "00"?

2.0.0p247 :001 > require 'rumoji'
 => true
2.0.0p247 :002 > Rumoji.encode("00")
 => ":zero:"

I think this is totally wrong! weird result when encoding a url http://bbs.zhibo8.cc/thread-1200214-1-1.html where 00 definitely shouldn't be encoded as :zero:..

Matched colons with no matching emojis should not be replaced

In the case of a custom CMS which uses colons as syntax, replacing everything that's surrounded by 2 colons doesn't seem like a good idea.

Example problematic situation:

(rdb:94) Rumoji.decode("this is a link to google: (link:http://google.com)")
"this is a link to google: (link//google.com)"
(rdb:94) Rumoji.decode("this is a link to google:(link:http://google.com)")
"this is a link to googlehttp://google.com)"
(rdb:94) Rumoji.decode("this is a link to google:http://google.com")
"this is a link to google//google.com"

Also, in case of a new or custom emoji, the current behavior represents a loss of information:

(rdb:94) Rumoji.decode("I'm :happy:")
"I'm "

Repeating any two numbers together produces emoji

11 -> 1⃣
22 -> 2⃣
33 -> 3⃣
44 -> 4⃣
... and so on.

Oddly enough, I added a spec for this to the rumoji specs and it passes.

describe 'edge cases' do
    describe 'a string containing the number 22' do
      let(:repeated_numbers) { "I am 22 years old" }
      subject { Rumoji.encode(repeated_numbers) }

      it 'does not convert 22 into cheat sheet code' do
        subject.must_equal repeated_numbers
      end
    end
  end

But if I do it in IRB...

irb(main):006:0> Rumoji.encode "I am 22 years old"
=> "I am :two: years old"
irb(main):007:0> "I am 22 years old".encoding
=> #<Encoding:UTF-8>

Any way we can avoid this?

iOS 10.x new food emojis

self.new("\u{1F95D}", [:kiwifruit] ),
self.new("\u{1F951}", [:avocado] ),
self.new("\u{1F952}", [:cucumber] ),
self.new("\u{1F955}", [:carrot] ),
self.new("\u{1F956}", [:baguette_bread] ),
self.new("\u{1F954}", [:potato] ),
self.new("\u{1F95A}", [:egg] ),
self.new("\u{1F95C}", [:peanuts] ),
self.new("\u{1F953}", [:bacon] ),
self.new("\u{1F950}", [:croissant] ),
self.new("\u{1F95E}", [:pancakes] ),
self.new("\u{1F957}", [:green_salad] ),
self.new("\u{1F959}", [:stuffed_flatbread] ),
self.new("\u{1F943}", [:tumbler_glass] ),
self.new("\u{1F942}", [:clinking_glasses] ),
self.new("\u{1F95B}", [:glass_of_milk] ),

1.9 only?

The README indicates only 1.9 testing. Is that still true?

Release new version

Hey!

Thanks for supporting this gem. It's been a while and a few new emojis since last version release, do you care for a new one?

Thanks

Latin Cross

For some reason when i try to encode the latin cross emoji the output includes a utf8 character which causes some DB issues since it is not a valid string.

ActiveRecord::StatementInvalid: Mysql2::Error: Incorrect string value: '\xEF\xB8\x8F...'

Looking up \xEF\xB8\x8F at the utf8 chartable it looks like this is an empty space character.

I am not asking how to fix the DB issue, i am asking however if you know why is it that the latin cross emoji contains that nasty utf8 character, and isn't there a better way to handle the encoding?

Normal emoji:

$ heart = "💟"
=> "💟"
$ heart.length
=> 1
$ encoded_heart = Rumoji.encode heart
=> ":heart_decoration:"

Latin Cross Emoji

$ string = "✝️"
=> "✝️"
$ string.length
=> 2

$ string[0]
=> "✝"
$ string[1]
=> "️"
$ string[1] == "\xEF\xB8\x8F"
=> true

Encoding

$ Rumoji.encode string
=> ":latin_cross:️"
$ Rumoji.decode Rumoji.encode(string)
=> "✝️"

$ Rumoji.encode string[0]
=> ":latin_cross:"
$ Rumoji.decode Rumoji.encode(string[0])
=> "✝"

$ Rumoji.encode string[1]
=> "️"
$ Rumoji.decode Rumoji.encode string[1]
=> "️"

Publish v0.5 ?

Hi, very nice gem, thanks for the good stuff.

However it was last published on June 11, 2015, and has had a very significant update since (0d5f7db), can you publish a new version please?

Wrong emoji

In my db I have the sad emoji
Image of sad

But using this code:

emojify(Rumoji.encode(comment.content))

I get this emoji displayed
Image of the wrong emoji

Usually it work but not for the decoding of this smiley (Have been using the plugin for 2 weeks so I may find other wrong smiley in the future)

Here is the information I could get about the smiley in db:
Image info

small desync witth emoji cheat sheet

Hey, I used this project to map the emoji cheet sheet (ecs) images to categories and along the way I found a few discrepancies.

dissapointed is disappointed on ecs
blossum is blossum on ecs
wink2 was replaced by stuck_out_tongue_winking_eye

Thanks for saving me a lot of time 😄

Cannot convert 🤡 and 🤣

I found a couple of emojis that Rumoji doesn't understand.

# :clown-face:, :rofl:
puts Rumoji.encode('🤡🤣')

gem version update please

As @celsodantas mentioned, the current gem is still encoding 00 and 11 etc

We have confirmed that the current repo version doesn't have the issue.

Could we get a version update published?

Thanks so much for the tool!

Loop over all emoji in string

Is it possible to loop over all the emoji in the string?

Example possible api:

> Rumoji.encode_each("🐻  regular text ♥️") { |emoji| "<<#{emoji.name}>>" }
> "<<bear>>  regular text <<hearts>>"

This would allow me to customize the display of emoji, converting them into images or stripping out undesirable ones. Ideally this would also work with mutli-character emoji like 👪🏾 as a single emoji: http://emojipedia.org/family-type-5/

Out of sync with the emoji cheat sheet

I've found that some emoji aren't translated from Unicode to the short code correctly.

For instance 🤘 should be :metal: according to the cheat sheet, but is translated as :sign_horns: by rumoji.

In this comment you mentioned having a script to scrape the cheat sheet. It might be nice to have that script in this repo somewhere, and a method for updating the gem accordingly. I'd be happy to help with that effort if you don't mind sharing the script.

Thanks for the excellent tool!

new emoji data

have something emoji data is fail

for example : \u1F917, \u1F5F3

how to solve

thanks

Does not match 465 new emoji

The emoji-cheat-sheet version loaded in the current rumoji does not have 465 emoji defined in the Unicode standard.

The real issue is that it doesn't seem that there's a shorthand defined yet for these emoji, so if rumoji were to support them it would need to make them up. What to do? I don't know.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.