Facebook如何在json Graph API中编码表情符号? [英] How does Facebook encode emoji in the json Graph API?
问题描述
低替代对似乎很好。例如,❤❤(HEAVY BLACK HEART,虽然在iOS / OSX中是红色的,但链接到图像if您不能看到表情符号)以 \\\❤\\\️
的形式出现,这似乎符合UTF-16十六进制代码/正式Unicode符号这里显示在 iemoji.com 。
事实上,在Ruby中解析API的JSON输出时:
ActiveSupport :: JSON.decode('\\\❤\\\️')
你正确地得到: p>
❤️
但是,要选择另一个表情符号,
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,
这篇关于Facebook如何在json Graph API中编码表情符号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!