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 r_mosaic
Recipients r_mosaic
Date 2009年07月22日.07:31:51
SpamBayes Score 8.062162e-12
Marked as misclassified No
Message-id <1248247915.99.0.198197502387.issue6543@psf.upfronthosting.co.za>
In-reply-to
Content
traceback information is wrongly encoded.
Steps to reproduce:
1. Use a version of Windows that supports CP936 (Simplified Chinese) as 
the default encoding.
2. Create a directory containing Chinese characters. Such as C:\测试
3. In the directory create a python file such as C:\测试\test.py
4. In the python file enter the following lines
import traceback
try:
 aaa # create a non-existent name
except Exception as ex:
 traceback.print_exc()
5. Run the program with this command line (remember to use full path to 
the test.py file):
C:\Python31\python.exe C:\测试\test.py
6. See the output.
Expected result:
There is correct output without encoding problems. Such as:
Traceback (most recent call last):
 File "C:\测试\test.py", line 3, in <module>
NameError: name 'aaa' is not defined
Actual result:
UTF-8 encoded string is decoded using CP936 so the output is incorrect.
Traceback (most recent call last):
 File "C:\娴嬭瘯\test.py", line 3, in <module>
NameError: name 'aaa' is not defined
Additional information:
In Python 3.0, such test would generate:
File "<decoding error>", line 221, in main
In Python 3.1, the test generates the output mentioned in the repro 
steps. As I tried traceback.format_exc(), it seems the original 
characters 测试 have become three Unicode characters when returned by 
format_exc().
History
Date User Action Args
2009年07月22日 07:31:56r_mosaicsetrecipients: + r_mosaic
2009年07月22日 07:31:56r_mosaicsetmessageid: <1248247915.99.0.198197502387.issue6543@psf.upfronthosting.co.za>
2009年07月22日 07:31:53r_mosaiclinkissue6543 messages
2009年07月22日 07:31:52r_mosaiccreate

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