【问题标题】:Why do twemoji fails with most of emoji unicodes?为什么 twemoji 在大多数 emoji unicode 上都失败了?
【发布时间】:2015-10-24 17:36:21
【问题描述】:

我在我的项目中使用库 twemoji

现在,GitHub 中的示例在我的本地计算机上运行良好,但如果我尝试这样做: twemoji.parse('\u1f600') 我得到一个奇怪的结果:ὠ0

在我看来,这个库适用于 4 数字 unicode,但无法使用 5 数字 unicode。

如何解决?

【问题讨论】:

    标签: javascript unicode emoji


    【解决方案1】:

    ECMA 脚本使用 16 位 unicode (UTF16),因此 '\u1f600' 确实解析为 ὠ0。 twemoji 有一个转换实用程序convert.fromCodePoint(STRING)。你可以试试convert.fromCodePoint('1f600')(没有前导\u!)。

    【讨论】:

    • 酷。非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-01-10
    • 1970-01-01
    • 1970-01-01
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 2014-12-28
    相关资源
    最近更新 更多