[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-18 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

See also #4621.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-18 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

This issue is just another example of the issue #10614: I'm closing it as a 
duplicate.

--
resolution:  - duplicate
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-12 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +haypo
versions: +Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

This is a duplicate of #10801, issue fixed in Python 3.2 or later by 
33543b4e0e5d. Should we backport the fix to Python 3.1, or you can upgrade to 
Python 3.2?

Output with Python 3.2: ╕┤╝■ test.txt.

--
versions:  -Python 3.2, Python 3.3

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-12 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
components: +Library (Lib), Unicode

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-12 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@haypocalc.com:


--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-12 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

But according to the initial report, 3.2 does not give the expected behavior. 
This zip file actually stores the filename encoded with cp932, which is 
incorrect according to the specifications of the ZIP format (only cp437 and 
utf8 are valid)

See issue10614 for a possible solution: allow users to specify an alternate 
encoding to handle such invalid files.

--
nosy: +amaury.forgeotdarc

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-12 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Oh, right.

Note: the encoding looks to be GBK, not CP932:

 '\u590d\u4ef6'.encode('gbk')
b'\xb8\xb4\xbc\xfe'
 '\u590d\u4ef6'.encode('gbk').decode('cp437')
'╕┤╝■'
 '\u590d\u4ef6'.encode('cp932')
...
UnicodeEncodeError: 'cp932' codec can't encode character '\u590d' ...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12048] Python 3, ZipFile Bug In Chinese

2011-05-10 Thread yaoyu

New submission from yaoyu yao...@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 rep...@bugs.python.org
http://bugs.python.org/issue12048
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com