[issue12048] Python 3, ZipFile Bug In Chinese
yaoyu
report at bugs.python.org
Tue May 10 09:59:57 CEST 2011
New submission from yaoyu <yao_yu at 126.com>:
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()
----------
files: test.zip
messages: 135687
nosy: yaoyu
priority: normal
severity: normal
status: open
title: Python 3, ZipFile Bug In Chinese
type: behavior
versions: Python 3.1, Python 3.2
Added file: http://bugs.python.org/file21952/test.zip
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12048>
_______________________________________
More information about the Python-bugs-list
mailing list