homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients amaury.forgeotdarc, vstinner
Date 2008年10月08日.10:51:39
SpamBayes Score 1.976197e-14
Marked as misclassified No
Message-id <1223463102.62.0.630828513223.issue3975@psf.upfronthosting.co.za>
In-reply-to
Content
> More fun will arise when my Windows terminal (encoding=cp1252) 
> will try to display Chinese characters. Let's pretend this is 
> yet another issue.
I tried the patch using a script with unicode characters (character 
not representable in ISO-8859-1 like polish characters ł and Ł).
Result in an UTF-8 terminal (my default locale):
 Traceback (most recent call last):
 File "unicode.py", line 2, in <module>
 raise ValueError("unicode: Łł")
 ValueError: unicode: Łł
=> correct
Result in an ISO-8859-1 terminal (I changed the encoding in my Konsole 
configuration):
 Traceback (most recent call last):
 File "unicode.py", line 2, in <module>
 raise ValueError("unicode: \u0141\u0142")
 ValueError: unicode: \u0141\u0142
=> correct
Why does it work? It's because PyErr_Display() uses sys.stderr instead 
of sys.stdout and sys.stderr uses a different unicode error mechanism:
 >>> import sys
 >>> sys.stdout.errors
 'strict'
 >>> sys.stderr.errors
 'backslashreplace'
Which is a great idea :-)
You can try on Windows using the new attached file unicode.py.
History
Date User Action Args
2008年10月08日 10:51:42vstinnersetrecipients: + vstinner, amaury.forgeotdarc
2008年10月08日 10:51:42vstinnersetmessageid: <1223463102.62.0.630828513223.issue3975@psf.upfronthosting.co.za>
2008年10月08日 10:51:41vstinnerlinkissue3975 messages
2008年10月08日 10:51:40vstinnercreate

AltStyle によって変換されたページ (->オリジナル) /