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 Dmitry.Jemerov
Recipients Dmitry.Jemerov
Date 2010年07月18日.11:54:52
SpamBayes Score 0.000279033
Marked as misclassified No
Message-id <1279454095.41.0.733053669611.issue9291@psf.upfronthosting.co.za>
In-reply-to
Content
On Windows, mimetypes initialization reads the list of MIME types from the Windows registry. It assumes that all characters are Latin-1 encoded, and fails when it's not the case, with the following exception:
Traceback (most recent call last):
 File "mttest.py", line 3, in <module>
 mimetypes.init()
 File "c:\Python27\lib\mimetypes.py", line 355, in init
 db.read_windows_registry()
 File "c:\Python27\lib\mimetypes.py", line 260, in read_windows_registry
 for ctype in enum_types(mimedb):
 File "c:\Python27\lib\mimetypes.py", line 250, in enum_types
 ctype = ctype.encode(default_encoding) # omit in 3.x!
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)
This can be reproduced, for example, on a Russian Windows XP installation which has QuickTime installed (QuickTime creates the non-Latin entries in the registry). The following line causes the exception to happen:
import mimetypes; mimetypes.init()
History
Date User Action Args
2010年07月18日 11:54:55Dmitry.Jemerovsetrecipients: + Dmitry.Jemerov
2010年07月18日 11:54:55Dmitry.Jemerovsetmessageid: <1279454095.41.0.733053669611.issue9291@psf.upfronthosting.co.za>
2010年07月18日 11:54:53Dmitry.Jemerovlinkissue9291 messages
2010年07月18日 11:54:52Dmitry.Jemerovcreate

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