[issue28080] Allow reading member names with bogus encodings in zipfile
Serhiy Storchaka
report at bugs.python.org
Mon Dec 26 08:29:49 EST 2016
Serhiy Storchaka added the comment:
A ZipFile can be read when open in not read-only mode. Thus the encoding argument should be accepted when mode != 'r'.
It would be weird to read file names and write new entries with different encodings. Thus the encoding argument should affect output encoding too.
You have named the new ZipFile attribute metadataEncoding. Indeed, I missed this, and other developers missed this when ported to Python 3, but the specification says, that the UTF-8 bit affect not just the encoding of file names, but the encoding of comments. Thus a file comment must be a string, and be decoded with the same encoding as a file name. Currently it is of type bytes. I don't know what is the best way to resolve this issue without breaking backward compatibility. Perhaps add the text_comment property.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28080>
_______________________________________
More information about the Python-bugs-list
mailing list