Some emojis are beyond the normal emoji unicode range.

I am trying to implement an UITextField where user cannot use an emoji. I have used the below code to filter emojis.

0x1F600...0x1F64F, // Emoticons 8400...8447: // Combining Diacritical Marks for Symbols 9100...9300, // Misc items 0x2600...0x26FF, // Misc symbols 0x2700...0x27BF, // Dingbats 0xFE00...0xFE0F, // Variation Selectors 0x1F018...0x1F270, // Various asian characters 0x1F300...0x1F5FF, // Misc Symbols and Pictographs 0x1F680...0x1F6FF, // Transport and Map 0x1F1E6...0x1F1FF, // Regional country flags 0x1F900...0x1F9FF, // Supplemental Symbols and Pictographs 65024...65039, // Variation selector

Found from here: https://developer.apple.com/forums/thread/110059

But for three emojis

  1. Blueberry Emoji (U + 1FAD0)
  2. Bell Pepper Emoji (U + 1FAD1)
  3. Olive Emoji (U + 1FAD2)

This is going out of range of above code and user can enter these three emojis. How can I handle this situation?

As you know, Unicode consortium will add many emojis every year.

https://unicode.org/emoji/charts/emoji-list.html

I can find some more characters in range U+1FAD3...U+1FAD6.

I'm not sure how many of them are already include in the Apple's emoji font, but eventually Apple may cover all.

Which means, you may need to update the range list every time Unicode emojis are updated.


One more, the code you found in the linked thread is far from complete.

As you see in the whole list of emojis, some emojis are made of multiple code points. But the method isEmoji(_:) detects all the variation selectors as emoji, although there are many cases non-emoji character having variation selector.

Find a better solution which detects emojis more completely, and which will be updated when Unicode standard is updated.

Some emojis are beyond the normal emoji unicode range.
 
 
Q