Message124499
| Author |
connexion2000 |
| Recipients |
connexion2000 |
| Date |
2010年12月22日.12:44:03 |
| SpamBayes Score |
9.436948e-05 |
| Marked as misclassified |
No |
| Message-id |
<1293021846.1.0.84362256489.issue10757@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 = 'somefile.dat'
filename = "ółśąśółąś.dat"
zip = zipfile.ZipFile('archive.zip', 'w', zipfile.ZIP_DEFLATED)
zip.write(file, filename.encode('cp852'))
this produces TypeError: expected an object with the buffer interface
Documentation says that:
There is no official file name encoding for ZIP files. If you have unicode file names, you must convert them to byte strings in your desired encoding before passing them to write().
I convert them to byte string but it ends with an error.
If it is documentation bug, what is the proper way to have filenames like "ółśąśółąś" in zip archive? |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2010年12月22日 12:44:06 | connexion2000 | set | recipients:
+ connexion2000 |
| 2010年12月22日 12:44:06 | connexion2000 | set | messageid: <1293021846.1.0.84362256489.issue10757@psf.upfronthosting.co.za> |
| 2010年12月22日 12:44:03 | connexion2000 | link | issue10757 messages |
| 2010年12月22日 12:44:03 | connexion2000 | create |
|