G
G
Gluck Virtualen2016-10-20 14:22:48
HTML
Gluck Virtualen, 2016-10-20 14:22:48

How are Emoticons "arranged"?

How are Emoticons "arranged"?
How can you unambiguously determine that they are present in the received response?
For example:

{
"date":1476961874,
"text":"\ud83c\udf45"
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mercury13, 2016-10-20
@gluck59

Question: are we parsing this JSON or not?
For simplicity, let's assume that we parse (well, or the JS translator parses - everything is the same). Then the text is encoded in UTF-16.
• Symbols 0000…D7FF - they are.
• Characters D800…DBFF - This character must be followed by a character from DC00…DFFF and form a surrogate pair that will be one character. Google "UTF-16" for details. If one of these two characters goes without a pair, it's invalid UTF-16.
• And characters E000…FFFF are also encoded as is.
This surrogate pair that you threw in is encoded into the symbol 1F345, some kind of tomato.
The function of converting a surrogate pair to a character code:
And what codes you don't need - dig Unicode tables.
An easier way that may work for you is to disable all surrogate pairs.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question