Forum Moderators: open

Message Too Old, No Replies

Facebook Style Emojis

         

typomaniac

3:26 pm on May 21, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



Recently someone copy pasted a Facebook message containing emojis into a textarea on our site with unexpected results, that is instead of an emoji appearing some really strange characters did I'm looking for the process that would add support for copy pasting these. Searches seem to always end up on how to paste them into FB.

While I was able to edit the strange figures out of the message, I would rather just make it possible.

lucy24

3:44 pm on May 21, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What sort of “really strange characters”? Garbled bits of Chinese, or Latin characters such as â and ä, or something else entirely? In questions like this, I tend to jump straight to: encoding mismatch.

typomaniac

4:26 pm on May 21, 2022 (gmt 0)

10+ Year Member Top Contributors Of The Month



lol, I guess terming them strange characters does invoke invaders from outer space but if a common smiley image is pasted I get something like this 🙂 In other words, the emoji the client pasted didn't appear. I had considered a regex that would just remove the characters not found on a keyboard but after a re-think have shelved that idea because so many people use emojis these days i decided it might be a better idea to find out how to add support for the little images. I don't want to add the emojis to the form like FB does but just add support so that if in the future a client copy pasted a FB post including emojis it would just go through. I hope this makes it more understandable.

lucy24

1:08 am on May 22, 2022 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yeah, that sounds like encoding. ð in Windows is F0, which introduces one of the emoji ranges. What’s happening is that the character is stored numerically as four hexadecimal pairs, and then something at the other end unpacks it into, most likely, some form of Latin-1.

For example:
if I type the “grinning face” emoticon
it is stored as the four bytes
F09F9880
which a Latin1-speaking function will turn into the four characters
😀

... and, as we know, the present site will decimalize it as
😀
but we’ll stipulate that it started out as a grinnning face ;)