mwunsch / rumoji Goto Github PK
View Code? Open in Web Editor NEWEncode 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
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
I noticed that "relaxed" emoji (
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:
..
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 "
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?
Unicode 9.0 is released on June 21, 2016 => http://emojipedia.org/unicode-9.0/
When will the Rumoji library support this? What is the plan of action here?
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] ),
The README indicates only 1.9 testing. Is that still true?
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
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?
$ heart = "💟"
=> "💟"
$ heart.length
=> 1
$ encoded_heart = Rumoji.encode heart
=> ":heart_decoration:"
$ string = "✝️"
=> "✝️"
$ string.length
=> 2
$ string[0]
=> "✝"
$ string[1]
=> "️"
$ string[1] == "\xEF\xB8\x8F"
=> true
$ 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]
=> "️"
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?
But using this code:
emojify(Rumoji.encode(comment.content))
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)
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 😄
I found a couple of emojis that Rumoji doesn't understand.
# :clown-face:, :rofl:
puts Rumoji.encode('🤡🤣')
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!
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/
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!
have something emoji data is fail
for example : \u1F917, \u1F5F3
how to solve
thanks
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.