[issue22802] On Windows, if you try and use ccs=UTF-8 (or other variants) the U is removed

Alex Earl report at bugs.python.org
Wed Nov 5 20:12:41 CET 2014


New submission from Alex Earl:

As you can see below, the code in fileobject.c is removing the U from the UTF-8 (or UNICODE) when it tries to replace a U for universal line ending mode.


Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('newfile.txt', 'rt+,ccs=UNICODE')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid mode ('rbt+,ccs=NICODE')
>>> f = open('newfile.txt', 'rt+,ccs=UTF-8')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Invalid mode ('rbt+,ccs=TF-8')


It looks to be an issue with the code around:

https://hg.python.org/cpython/file/ee879c0ffa11/Objects/fileobject.c#l283

----------
components: IO, Windows
messages: 230705
nosy: Alex.Earl, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: On Windows, if you try and use ccs=UTF-8 (or other variants) the U is removed
type: behavior
versions: Python 2.7

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


More information about the Python-bugs-list mailing list