Ren Ren - 2 months ago 5
Python Question

Why are there blank spaces in the Unicode character table and how do I check if a unicode value is one of those?

If you check out the Unicode Table, there are several spaces further in the table that are simply blank. There's a unicode value, but no character, ex. U+0BA5. Why are there these empty places?

Second of all, how would I check if a unicode value is one of these empty spaces? My code determines a unicode value using unichr(int), which returns a valid unicode value, but I don't know how to check if this unicode value will simply appear as an empty box.

Answer

Not all Unicode codepoints have received an assignment; this can be for any number of reasons, historical, practical, policital, etc.

You can test if a given codepoint has a Unicode name, by using the unicodedata.name() function; it'll raise a ValueError when a codepoint has no name assigned to it:

>>> import unicodedata
>>> unicodedata.name(u'\u0BA5')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: no such name
Comments