Does anyone know how Facebook encodes emoji with high-surrogate pairs in the Graph API?
Low surrogate pairs seem fine. For example, ❤️ (HEAVY BLACK HEART, though it is red in iOS/OSX, link to image if you can't see the emoji) comes through as \u2764\ufe0f which appears to match the UTF-16 hex codes / "Formal Unicode Notation" shown here at iemoji.com.
And indeed, in Ruby when parsing the JSON output from the API:
ActiveSupport::JSON.decode('"\u2764\ufe0f"')
you correctly get:
"❤️"
However, to pick another emoji, ???? (SLEEPING SYMBOL, link to image here. Facebook returns \udbba\udf59. This seems to correspond with nothing I can find on any unicode resources, e.g., for example this one at iemoji.com.
And when I attempt to decode in Ruby using the same method above:
ActiveSupport::JSON.decode('"\udbba\udf59"')
I get:
"????"
Any idea what's going on here?
\u2764\ufe0fisn't a surrogate pair, it's a normal Basic Multilingual Plane character followed by a variation selector. Using a variant to try to distinguish when emoji should be rendered as colour icons is an ugly new addition in Unicode 6.2.\udbba\udf59does seem to be an error though... the corresponding codepoint U+FEB59 is Private Use character that you shouldn't be getting. - bobinceU+2764works. But one that looks likeU+1F4A4(note the 1) does not. - philoye