[issue4621] zipfile returns string but expects binary

2011-05-18 Thread Tor Arvid Lund
Tor Arvid Lund torar...@gmail.com added the comment: I was wondering what has prevented Eddies patch from being included into python. Has nobody volunteered to verify that it works? I would be willing to do that, though I have never compiled python on any platform before. It just seems a bit

[issue4621] zipfile returns string but expects binary

2011-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: This issue looks to be a duplicate of #10801 which was only fixed (33543b4e0e5d) in Python 3.2. See also #12048: similar issue in Python 3.1. -- ___ Python tracker rep...@bugs.python.org

[issue4621] zipfile returns string but expects binary

2011-05-18 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: The initial problem is clearly a duplicate of issue #10801 which is now fixed in Python 3.1+ (I just backported the fix to Python 3.1). I just discovered that attempting to open zip member test\file fails where attempting to open

[issue4621] zipfile returns string but expects binary

2010-03-26 Thread Glenn Linderman
Glenn Linderman v+pyt...@g.nevcal.com added the comment: I just discovered that attempting to open zip member test\file fails where attempting to open test/file works. Granted the zip contains / not \ characters, but using the os.path stuff (on windows) to manipulate the names before

[issue4621] zipfile returns string but expects binary

2008-12-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: In the ZIP file format, a filename is a byte string because we don't know the encoding. You can not guess the encoding because it's not stored in the ZIP file and it depends on the OS and the OS configuration. So t1.filename have

[issue4621] zipfile returns string but expects binary

2008-12-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Oh, I see that zipfile.py uses the following code to choose the filename encoding: if flags 0x800: # UTF-8 file names extension filename = filename.decode('utf-8') else:

[issue4621] zipfile returns string but expects binary

2008-12-20 Thread STINNER Victor
STINNER Victor victor.stin...@haypocalc.com added the comment: Test on Ubuntu Gutsy (utf8 file system) with zip 2.32: $ mkdir x $ touch x/hé $ zip -r x.zip x adding: x/ (stored 0%) adding: x/hé (stored 0%) $ python # 3.0 trunk import zipfile testzip = zipfile.ZipFile('x.zip')

[issue4621] zipfile returns string but expects binary

2008-12-20 Thread Eddie
Eddie skr...@gmail.com added the comment: The problem is not about reading the filenames, but reading the contents of a file with filename that has non-ascii charaters. ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4621

[issue4621] zipfile returns string but expects binary

2008-12-20 Thread Eddie
Eddie skr...@gmail.com added the comment: I read again what STINNER Victor and I think that he found another bug. Because, when listing the filenames of that zip file, the names are not displayed correctly. In fact 'x/h├⌐' == 'x/hé'.encode('utf-8').decode('cp437') So, there is again a problem

[issue4621] zipfile returns string but expects binary

2008-12-20 Thread Eddie
Eddie skr...@gmail.com added the comment: Attached is a patch that solves (I hope) the initial problem, the one from Francesco Ricciardi. -- keywords: +patch Added file: http://bugs.python.org/file12409/patch.diff ___ Python tracker

[issue4621] zipfile returns string but expects binary

2008-12-18 Thread Eddie
Eddie skr...@gmail.com added the comment: Sorry, my bad. I did tried it but with the wrong version (2.5). And it worked perfectly. So sorry again for my mistake. Anyways, I've found the error. The problem is caused by different encodings used when zipping. In open, the method is comparing

[issue4621] zipfile returns string but expects binary

2008-12-17 Thread Francesco Ricciardi
Francesco Ricciardi francesco.riccia...@hp.com added the comment: If that is what is requested, then the manual entry for ZipFile.read must be corrected, because it states: ZipFile.read(name[, pwd]) name is the name of the file in the archive, or a ZipInfo object. However, Eddie, you

[issue4621] zipfile returns string but expects binary

2008-12-10 Thread Francesco Ricciardi
New submission from Francesco Ricciardi [EMAIL PROTECTED]: Each entry of a zip file, as read by the zipfile module, can be accessed via a ZipInfo object. The filename attribute of ZipInfo is a string. However, the read method of a ZipFile object expects a binary as argument, or at least this is