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 jaraco
Recipients jaraco
Date 2011年12月26日.15:55:31
SpamBayes Score 8.0930205e-09
Marked as misclassified No
Message-id <1324914932.64.0.469258692044.issue13664@psf.upfronthosting.co.za>
In-reply-to
Content
While investigating #11638, I encountered another encoding issue related to tarballs. Consider this command:
python -c "import gzip; gzip.GzipFile(u'\xe5rchive', 'w', fileobj=open(u'\xe5rchive', 'wb'))"
When run, it triggers the following traceback:
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "c:\python\lib\gzip.py", line 127, in __init__
 self._write_gzip_header()
 File "c:\python\lib\gzip.py", line 172, in _write_gzip_header
 self.fileobj.write(fname + '000円')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe5' in position 0: ordinal not in range(128)
Based on the resolution of #13639, I believe the recommended fix is to handle unicode here much like Python 3 does--specifically, detect unicode, encode to 'latin-1' if possible or leave the filename blank if not.
History
Date User Action Args
2011年12月26日 15:55:32jaracosetrecipients: + jaraco
2011年12月26日 15:55:32jaracosetmessageid: <1324914932.64.0.469258692044.issue13664@psf.upfronthosting.co.za>
2011年12月26日 15:55:32jaracolinkissue13664 messages
2011年12月26日 15:55:31jaracocreate

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