Message150265
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. |
|
Date |
User |
Action |
Args |
2011-12-26 15:55:32 | jaraco | set | recipients:
+ jaraco |
2011-12-26 15:55:32 | jaraco | set | messageid: <1324914932.64.0.469258692044.issue13664@psf.upfronthosting.co.za> |
2011-12-26 15:55:32 | jaraco | link | issue13664 messages |
2011-12-26 15:55:31 | jaraco | create | |
|