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, bferris57, ezio.melotti, r.david.murray, vstinner
Date 2011年07月26日.14:32:24
SpamBayes Score 2.1529334e-11
Marked as misclassified No
Message-id <4E2ECFFA.2000202@haypocalc.com>
In-reply-to <1311688410.66.0.532718568611.issue12632@psf.upfronthosting.co.za>
Content
> All I'm trying to do is run different versions of Python on the same machine from the command line.
> Some code inside Python now "break" if Python 3.1 is started with Code Page 65001.
Yes, this issue can be seen as a regression introduced in Python 3.
> I fully understand the change between Python 2.7 and 3.1 were probably due to trying to fix issue #1602 (or some other related issue).
Python 2 and 3 are very different. In Python 2, print "abc" writes a 
byte string to stdout, whereas print("abc") writes a Unicode string to 
stdout. Byte strings and character strings are two different things ;-)
Python 3 now uses Unicode by default and it requires a codec to encode 
strings to stdout. If your program don't output anything to stdout, use 
pythonw.exe instead of python.exe.
The issue #1602 is not specific to Python 3: Python 2 is unable to 
display correctly Unicode strings in the Windows console. It's less 
important in Python 2, because most developers use the default string 
type which is a byte string.
> Setting my cmd.exe code page to 65001 shouldn't mean a thing to Python if it can't associate it with an encoding. It could, at least, just switch to 7-Bit ASCII and proceed on. That would be better than failing!
I don't like this idea. In Python, we try to not ignore errors, but try 
instead to fix them or at least fail with an error message (the user is 
responsible to fix it or use a workaround). To fix this issue, we have 
to implement a cp65001 codec for Python or to work directly in Unicode 
using WriteConsole.
If you cannot help to implement one of this option, you can use a 
workaround:
 - don't change the codepage
 - use PYTHONIOENCODING=utf-8
History
Date User Action Args
2011年07月26日 14:32:25vstinnersetrecipients: + vstinner, amaury.forgeotdarc, ezio.melotti, r.david.murray, bferris57
2011年07月26日 14:32:24vstinnerlinkissue12632 messages
2011年07月26日 14:32:24vstinnercreate

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