[New-bugs-announce] [issue36061] zipfile does not handle arcnames with non-ascii characters on Windows

Shane Lee report at bugs.python.org
Wed Feb 20 20:59:30 EST 2019


New submission from Shane Lee <shane.d.lee at gmail.com>:

Python 2.7.15 (probably affects newer versions as well)

Given an archive with any number of files inside that have non-ascii characters in their filename `zipfile` will crash when extracting them to the file system.

```
Traceback (most recent call last):
  File "c:\dev\salt\salt\modules\archive.py", line 1081, in unzip
    zfile.extract(target, dest, password)
  File "c:\python27\lib\zipfile.py", line 1028, in extract
    return self._extract_member(member, path, pwd)
  File "c:\python27\lib\zipfile.py", line 1069, in _extract_member
    targetpath = os.path.join(targetpath, arcname)
  File "c:\python27\lib\ntpath.py", line 85, in join
    result_path = result_path + p_path
UnicodeDecodeError: 'ascii' codec can't decode byte 0x82 in position 3: ordinal not in range(128)
```

----------
components: Windows
files: test.zip
messages: 336172
nosy: Shane Lee, paul.moore, steve.dower, tim.golden, zach.ware
priority: normal
severity: normal
status: open
title: zipfile does not handle arcnames with non-ascii characters on Windows
type: behavior
versions: Python 2.7
Added file: https://bugs.python.org/file48159/test.zip

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36061>
_______________________________________


More information about the New-bugs-announce mailing list