STINNER Victor <victor.stin...@haypocalc.com> added the comment:

Attached patch fixes _some_str() function of the traceback module: encode 
unicode exception message to ASCII using backslashreplace error handler. ASCII 
is not the best choice, but str(unicode(...)) uses also ASCII (the default 
encoding) and we don't know the terminal encoding in traceback. We cannot do 
better here in Python2 (without breaking a lot of APIs...).

The right fix is to use Python3 which formats a traceback to unicode (unicode 
characters of the error message are kept unchanged). The choice of the encoding 
and error handler is made only at the end, when writing the output to the 
terminal, which is the right thing to do.

----------
Added file: http://bugs.python.org/file17202/traceback_unicode.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8313>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to