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 <>
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 "", line 3, in <module>
  File "c:\Python27\lib\", line 355, in init
  File "c:\Python27\lib\", line 260, in read_windows_registry
    for ctype in enum_types(mimedb):
  File "c:\Python27\lib\", 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()
Date User Action Args
2010-07-18 11:54:55Dmitry.Jemerovsetrecipients: + Dmitry.Jemerov
2010-07-18 11:54:55Dmitry.Jemerovsetmessageid: <>
2010-07-18 11:54:53Dmitry.Jemerovlinkissue9291 messages
2010-07-18 11:54:52Dmitry.Jemerovcreate