Emoji value range

旧城冷巷雨未停 提交于 2019-12-17 16:21:45

问题


I was trying to take out all emoji chars out of a string (like a sanitizer). But I cannot find a complete set of emoji values.

What is the complete set of emoji chars' UTF16 values?


回答1:


The Unicode standard's Unicode® Technical Report #51 includes a list of emoji (emoji-data.txt):

...
21A9 ;  text ;  L1 ;    none ;  j   # V1.1 (↩) LEFTWARDS ARROW WITH HOOK
21AA ;  text ;  L1 ;    none ;  j   # V1.1 (↪) RIGHTWARDS ARROW WITH HOOK
231A ;  emoji ; L1 ;    none ;  j   # V1.1 (⌚) WATCH
231B ;  emoji ; L1 ;    none ;  j   # V1.1 (⌛) HOURGLASS
...

I believe you would want to remove each character listed in this document which had a Default_Emoji_Style of emoji.

There is no way, other than reference to a definition list like this, to identify the emoji characters in Unicode. As the reference to the FAQ says, they are spread throughout different blocks.




回答2:


unicode-range: U+0080-02AF, U+0300-03FF, U+0600-06FF, U+0C00-0C7F, U+1DC0-1DFF, U+1E00-1EFF, U+2000-209F, U+20D0-214F, U+2190-23FF, U+2460-25FF, U+2600-27EF, U+2900-29FF, U+2B00-2BFF, U+2C60-2C7F, U+2E00-2E7F, U+3000-303F, U+A490-A4CF, U+E000-F8FF, U+FE00-FE0F, U+FE30-FE4F, U+1F000-1F02F, U+1F0A0-1F0FF, U+1F100-1F64F, U+1F680-1F6FF, U+1F910-1F96B, U+1F980-1F9E0;




回答3:


If you only deal with English character and emoji character I think it is doable. First convert your string to UTF-16 characters, then check each characters whose value is bigger than 0x0xD800 (for emoji it is actually >=0xD836) should be emoji.

This is because "The Unicode standard permanently reserves the code point values between 0xD800 to 0xDFFF for UTF-16 encoding of the high and low surrogates" and of course English characters (and many other character won't fall in this range)

But because emoji code point starts from U1F300 their UFT-16 value actually fall in this range.

Check here for a quick reference for emoji UFT-16 value, if you don't bother to do it yourself.



来源:https://stackoverflow.com/questions/30470079/emoji-value-range

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!