New submission from Stefan Holek:

Please allow for surrogates in the zipfile module like it was done for tarfile 
in #8390.

Currently zipfile breaks when encountering surrogates:

Traceback (most recent call last):
  File "/usr/local/python3.3/lib/python3.3/zipfile.py", line 392, in 
_encodeFilenameFlags
    return self.filename.encode('ascii'), self.flag_bits
UnicodeEncodeError: 'ascii' codec can't encode character '\udcfc' in position 
21: ordinal not in range(128)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "setup.py", line 20, in <module>
    'setuptools',
  File "/usr/local/python3.3/lib/python3.3/distutils/core.py", line 148, in 
setup
    dist.run_commands()
  File "/usr/local/python3.3/lib/python3.3/distutils/dist.py", line 917, in 
run_commands
    self.run_command(cmd)
  File "/usr/local/python3.3/lib/python3.3/distutils/dist.py", line 936, in 
run_command
    cmd_obj.run()
  File 
"/home/stefan/sandbox/setuptools-git/lib/python3.3/site-packages/distribute-0.6.30-py3.3.egg/setuptools/command/sdist.py",
 line 161, in run
    self.make_distribution()
  File "/usr/local/python3.3/lib/python3.3/distutils/command/sdist.py", line 
447, in make_distribution
    file = self.make_archive(base_name, fmt, base_dir=base_dir)
  File "/usr/local/python3.3/lib/python3.3/distutils/cmd.py", line 370, in 
make_archive
    dry_run=self.dry_run)
  File "/usr/local/python3.3/lib/python3.3/distutils/archive_util.py", line 
178, in make_archive
    filename = func(base_name, base_dir, **kwargs)
  File "/usr/local/python3.3/lib/python3.3/distutils/archive_util.py", line 
118, in make_zipfile
    zip.write(path, path)
  File "/usr/local/python3.3/lib/python3.3/zipfile.py", line 1328, in write
    self.fp.write(zinfo.FileHeader())
  File "/usr/local/python3.3/lib/python3.3/zipfile.py", line 382, in FileHeader
    filename, flag_bits = self._encodeFilenameFlags()
  File "/usr/local/python3.3/lib/python3.3/zipfile.py", line 394, in 
_encodeFilenameFlags
    return self.filename.encode('utf-8'), self.flag_bits | 0x800
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcfc' in position 
21: surrogates not allowed

----------
components: Library (Lib), Unicode
messages: 173676
nosy: ezio.melotti, stefanholek
priority: normal
severity: normal
status: open
title: zipfile: allow surrogates in filenames
versions: Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16310>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to