The curses.ascii
module has some nice functions defined, that allow for example to recognize which characters are printable (curses.ascii.isprint(ch)
).
But, diffrent character codes can be printable depending on which locale setting is being used. For example, there are certain polish characters:
>>> ord('a')
97
>>> ord('ą')
177
>>>
I'm wondering, is there a better way to tell if a number represents printable character then the one used in curses.ascii
module:
def isprint(c): return _ctoi(c) >= 32 and _ctoi(c) <= 126
which is kind of locale-unfriendly.