[issue12632] Windows GPF with Code Page 65001

Bruce Ferris report at bugs.python.org
Tue Jul 26 15:53:30 CEST 2011


Bruce Ferris <bferris57 at bferris.co.uk> added the comment:

Victor, thanks for replying and I've had a quick read of everything that went on for issue #1602.  I think there's some misunderstanding in what I'm saying here.  Maybe this will help clear up what I'm saying...

  D:\>chcp
  Active code page: 850

  D:\>chcp 65001
  Active code page: 65001

  D:\>python27\python
  Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit 
  (Intel)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> ^Z

  D:\>python31\python
  Fatal Python error: Py_Initialize: can't initialize sys standard
  streams
  LookupError: unknown encoding: cp65001

  This application has requested the Runtime to terminate it in an
  unusual way.
  Please contact the application's support team for more information.

  D:\>chcp 850
  Active code page: 850

  D:\>python31\python
  Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit
  (Intel)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  >>> ^Z

  D:\>

You see, I'm NOT trying to output any Unicode or UTF-8 characters.  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.

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).

But, as a side-effect to that "fix", if you now start Python 3.1 (and maybe beyond) with code page set to 65001, it refuses to work but it didn't used to refuse to work.

Evidently, Python now tries using the Code Page as an encoding lookup.  But, it didn't used to in 2.7.  So, there's another compatability issue introduced.

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!

That's my whole point.  If Python want to do some tweeking with code pages to get it's job done, that's fine by me, as long as it doesn't "break" and restores whatever code page I had set when I started it.

It's not down to a UTF-8 issue, it's about a compatability issue introduced sometime in the last year or so as a side-effect of trying to resolve a UTF-8 issue, probably #1602.

That's all!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12632>
_______________________________________


More information about the Python-bugs-list mailing list