[issue10757] zipfile.write, arcname should be bytestring

2010-12-26 Thread Martin v . Löwis
Martin v. Löwis added the comment: > So, in reverse of issue 4871, it appears that in this case the API should > reject bytes input with an appropriate error message. -1. It is quite common to produce ill-formed zipfiles, and other ziptools are interpreting them in violation of the format spec

[issue10757] zipfile.write, arcname should be bytestring

2010-12-25 Thread R. David Murray
R. David Murray added the comment: See also msg79724 of issue 4871. From looking at the code it appears that the filename must be a string, and if it contains only ASCII characters it is entered as ascii, while if it contains non-ascii it is encoded to utf-8 and the appropriate flag bits set

[issue10757] zipfile.write, arcname should be bytestring

2010-12-24 Thread Terry J. Reedy
Changes by Terry J. Reedy : -- nosy: +aimacintyre stage: -> unit test needed type: compile error -> behavior versions: +Python 3.2 ___ Python tracker ___ ___

[issue10757] zipfile.write, arcname should be bytestring

2010-12-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: Oops, I take this back - I didn't notice you were using Python 3.1. In any case, your first code is correct. What you get is the best you can ask for. That the second case fails is indeed a bug. -- resolution: invalid -> status: closed -> open ___

[issue10757] zipfile.write, arcname should be bytestring

2010-12-22 Thread Martin v . Löwis
Martin v. Löwis added the comment: This is not a bug. Your code that produces "very nasty filename" is the right one - the file name is actually the one you asked for. The second code is also behaving correctly: filename already *is* a bytestring, calling .encode for it is meaningless. -

[issue10757] zipfile.write, arcname should be bytestring

2010-12-22 Thread Jacek Jabłoński
New submission from Jacek Jabłoński : file = 'somefile.dat' filename = "ółśąśółąś.dat" zip = zipfile.ZipFile('archive.zip', 'w', zipfile.ZIP_DEFLATED) zip.write(file, filename) above produces very nasty filename in zip archive. * file =