Facebook如何在json Graph API中编码表情符号? [英] How does Facebook encode emoji in the json Graph API?

查看:384
本文介绍了Facebook如何在json Graph API中编码表情符号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道Facebook如何用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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆