为什么大多数表情符号 unicode 都无法使用 twemoji?
Why do twemoji fails with most of emoji unicodes?
我在我的项目中使用库 twemoji。
现在,GitHub 中的示例在我的本地计算机上运行良好,但如果我尝试这样做:
twemoji.parse('\u1f600')
我得到一个奇怪的结果:ὠ0
。
在我看来,这个库对 4
位 unicode 工作正常,但对 5
位 unicode 失败。
如何解决?
ECMA 脚本使用 16 位 unicode (UTF16),因此 '\u1f600'
确实解析为 ὠ0
。 twemoji 有一个转换实用程序 convert.fromCodePoint(STRING)
。您可以尝试使用 convert.fromCodePoint('1f600')
(无前导 \u
!)。
我在我的项目中使用库 twemoji。
现在,GitHub 中的示例在我的本地计算机上运行良好,但如果我尝试这样做:
twemoji.parse('\u1f600')
我得到一个奇怪的结果:ὠ0
。
在我看来,这个库对 4
位 unicode 工作正常,但对 5
位 unicode 失败。
如何解决?
ECMA 脚本使用 16 位 unicode (UTF16),因此 '\u1f600'
确实解析为 ὠ0
。 twemoji 有一个转换实用程序 convert.fromCodePoint(STRING)
。您可以尝试使用 convert.fromCodePoint('1f600')
(无前导 \u
!)。