cspeterson / splatmoji

Quickly look up and input emoji and/or emoticons/kaomoji on your GNU/Linux desktop via pop-up menu.
MIT License
212 stars 19 forks source link

When I type certain characters, extra characters are copied along with them. #34

Closed matoken closed 3 years ago

matoken commented 3 years ago

Hello. I've used several emoji input tools and splatmoji is the easiest to use 😀 .

However, I've noticed that when I input certain emoji into Twitter and display them in Tweetdeck, I get broken images.

20210223_17:02:58-668852 https://twitter.com/matoken1/status/1364133839593828353

Checking the character code, it seems that extra characters are included.

Copy and paste from the web.

$ echo -n '🎮' | od -x
0000000 9ff0 ae8e
0000004

Input with splatmoji copy.

$ echo -n '🎮️' | od -x
0000000 9ff0 ae8e b8ef 008f
0000007

It also happens with other emoji like 💻️📚️.

cspeterson commented 3 years ago

Explanation

Presentation issues in Tweetdeck aside, the extra characters you are seeing on some of the emoji are actually there on purpose! 🙂

The basic history is there are some emoji from the early days that can be validly shown by either their early-days "text presentation" or their more modern "emoji presentation."

This page I just searched up shows these presentations side by side for reference: https://character.construction/emoji-vs-text

So given the possibility that these emoji can be (and were, for some people on some platforms under some conditions) presented as their basic old text version when encoded all by their lonesome, I made the move to explicitly include "emoji presentation selector" character on the tail of all of these emoji (in my splatmoji-emojidata project that produces the emoji data files). This ensures that we get the pretty version.

Deeper technical specifics on presentation sequences: UTS #51

Tweetdeck etc

I just tweeted some of these emoji with Twitter and viewed them in Tweetdeck and verified that that the emoji presentation sequence made it all the way through and it all looked exactly as you'd hope. In fact when I view your Tweet that you linked everything looks great on my end! 😬

So I have a feeling this is an issue with something else in your pipeline. What platform are you on? Browser? Etc? Which emoji font? Does it present correctly in a different browser?

Bad hack solution

Not that I'm recommending it, but if you're just dying to "fix" this without actually fixing anything, you could programmatically strip the emoji presentation selector from your copies of the datafiles and call it a day. Maybe just fix your emoji stuff instead though. 😉

cspeterson commented 3 years ago

tbh I couldn't even remember the details of all of this until I went back and looked at the code

I should probably add this to the FAQ 🙂

cspeterson commented 3 years ago

done did it

https://github.com/cspeterson/splatmoji#when-i-type-certain-characters-extra-characters-are-copied-along-with-them

cspeterson commented 3 years ago

Closing the issue but happy to hear about your progress getting your emoji properly presented 🙂

matoken commented 3 years ago

Thank you for the detailed explanation.

My environment was Brave browser on Linux Debian sid amd64. When I try it with FIrefox, the problem does not occur 😀🦊