0

I am using Fedora and Python3, and I want to enumerate all the characters by chr, like using the following program.

for i in range(0x10ffff + 1) :
    try :
        print(i, chr(i), sep='\t')
    except UnicodeEncodeError :
        print('Error:', i)

However, There are many characters which seems to be undefined, and is displayed by a small square with a hex representation inside it (like shown in the picture).

enter image description here

The question is, how can I use the program decide whether a unicode character is defined (like English letters and Chinese and Japanese characters), or is undefined (like in the picture).

Thanks.

Eric Stdlib
  • 1,292
  • 1
  • 18
  • 32
  • 3
    The meaning of this is that the font you use doesn't have the glyph required to display it, it's not related to Python. – mwil.me May 17 '17 at 02:53
  • 1
    There's a difference between a character being defined or undefined (and there are also *private use areas* which anyone can define any way they like), and having a font installed that can render that particular glyph. – deceze May 17 '17 at 02:55
  • So is it possible to determine whether the font file has defined the character with Python? – Eric Stdlib May 17 '17 at 08:27
  • Does this answer your question? [python unicode rendering: how to know if a unicode character is missing from the font](https://stackoverflow.com/questions/43834362/python-unicode-rendering-how-to-know-if-a-unicode-character-is-missing-from-the) – Boris Verkhovskiy Apr 03 '20 at 09:40

0 Answers0