homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author yaoyu
Recipients yaoyu
Date 2011年05月10日.07:59:56
SpamBayes Score 6.961316e-10
Marked as misclassified No
Message-id <1305014397.56.0.923241033175.issue12048@psf.upfronthosting.co.za>
In-reply-to
Content
Python 3, ZipFile Bug In Chinese:
1. In Python3.1.3 can't extract "复件 test.txt" from test.zip
╕┤╝しかく test.txt
Traceback (most recent call last):
 File "C:\Temp\PythonZipTest\pythonzip.py", line 14, in <module>
 main()
 File "C:\Temp\PythonZipTest\pythonzip.py", line 11, in main
 z.extract(z.namelist()[0])
 File "c:\python31\lib\zipfile.py", line 980, in extract
 return self._extract_member(member, path, pwd)
 File "c:\python31\lib\zipfile.py", line 1023, in _extract_member
 source = self.open(member, pwd=pwd)
 File "c:\python31\lib\zipfile.py", line 928, in open
 % (zinfo.orig_filename, fname))
zipfile.BadZipfile: File name in directory '╕┤╝しかく test.txt' and header b'\xb8\xb4\xbc\xfe test.txt' differ.
2. In Python3.2 extract "复件 test.txt" from test.zip uncorrect
 It extract the file as "╕┤╝しかく test.txt"
3. In Python 2.7.1, It's OK!
     2011年05月10日
Source Code
######################################################################
#coding=gbk
import zipfile
import os
def main():
 szTestDir = os.path.dirname(__file__)
 szFile = os.path.join(szTestDir, 'test.zip')
 z = zipfile.ZipFile(szFile)
 print(z.namelist()[0])
 z.extract(z.namelist()[0])
if __name__ == '__main__':
 main()
History
Date User Action Args
2011年05月10日 07:59:57yaoyusetrecipients: + yaoyu
2011年05月10日 07:59:57yaoyusetmessageid: <1305014397.56.0.923241033175.issue12048@psf.upfronthosting.co.za>
2011年05月10日 07:59:56yaoyulinkissue12048 messages
2011年05月10日 07:59:56yaoyucreate

AltStyle によって変換されたページ (->オリジナル) /