Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latin Cross #50

Open
amitfriedman12 opened this issue Jan 10, 2019 · 0 comments
Open

Latin Cross #50

amitfriedman12 opened this issue Jan 10, 2019 · 0 comments

Comments

@amitfriedman12
Copy link

amitfriedman12 commented Jan 10, 2019

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]
=> "️"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant