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.
Created on 2010年11月21日 14:10 by aclover, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| mimetypes-patch2-2.7.patch | aclover, 2010年11月21日 14:13 | remove troublesome encode | ||
| Messages (2) | |||
|---|---|---|---|
| msg121929 - (view) | Author: And Clover (aclover) * | Date: 2010年11月21日 14:10 | |
The `enum_types` function in `MimeTypes.read_windows_registry` tries to `.encode` the results of `EnumKey`, assuming it to be a Unicode string. However, `_winreg.EnumKey` in Python 2.x actually returns a byte string (straight from the ANSI version of the registry interface). Consequently, if there is a MIME type registered with a non-ASCII character in its name (invalid, but not unheard of), initialising `MimeTypes` will raise a `UnicodeDecodeError`. This is not caught (it is only expecting a `UnicodeEncodeError`), so it bombs out whatever module indirectly caused `mimetypes.init()` to be called. This attempt to `.encode` the `ctype` should simply be removed. |
|||
| msg122163 - (view) | Author: R. David Murray (r.david.murray) * (Python committer) | Date: 2010年11月22日 20:24 | |
This is a duplicate if issue 9291. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:09 | admin | set | github: 54699 |
| 2010年11月22日 20:24:33 | r.david.murray | set | status: open -> closed nosy: + r.david.murray messages: + msg122163 superseder: mimetypes initialization fails on Windows because of non-Latin characters in registry stage: resolved |
| 2010年11月22日 14:02:29 | aclover | set | type: behavior |
| 2010年11月21日 14:13:08 | aclover | set | files: + mimetypes-patch2-2.7.patch |
| 2010年11月21日 14:12:52 | aclover | set | files: - mimetypes-patch2-2.7.patch |
| 2010年11月21日 14:10:23 | aclover | create | |