>Until Python 2.5, the exception object still uses ansi string. Thus,I disagree. But if you'd rather see the character (or a replacement character,
in the following example:
f = open(u"\u6d4b.log")
Suppose the file to open does not exist, the output message of the
exception maybe like:
[Errno 2] No such file or directory: u'\u6d4b.log'
This is not a clear message.
or possibly an empty box, depending on your environment's text rendering
capabilities), it's a bit easier than writing that big function:
.... except IOError, e: print str(e).decode('unicode-escape')>>try: open(u'\N{WHITE SMILING FACE}')
....
[Errno 2] No such file or directory: u'☺'
Jean-Paul>>