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.

classification
Title: email.message.py charset can be unicode instance
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: barry Nosy List: barry, loewis, tkikuchi
Priority: high Keywords: patch

Created on 2006-03-13 23:55 by tkikuchi, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
message.py.patch tkikuchi, 2006-03-13 23:55 email-4.0a2 message.py patch
email.1449244.patch tkikuchi, 2007-03-06 20:12 charset unicode patch with test case
Messages (4)
msg49732 - (view) Author: Tokio Kikuchi (tkikuchi) Date: 2006-03-13 23:55
*_charset in Charset become unicode instance in
email-4.0a. message.py should add this for type test.

--- email-4.0a2/email/message.py  Mon Mar  6 04:58:33 2006
+++ email/message.py    Mon Mar  6 14:59:04 2006
@@ -238,7 +238,7 @@
             self.del_param('charset')
             self._charset = None
             return
-        if isinstance(charset, str):
+        if isinstance(charset, str) or
isinstance(charset, unicode):
             charset = email.charset.Charset(charset)
         if not isinstance(charset, email.charset.Charset):
             raise TypeError(charset) 
msg49733 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-05 13:17
Can you please include a test case for this, as a patch to the current test suite, using the unittest framework?
msg49734 - (view) Author: Tokio Kikuchi (tkikuchi) Date: 2007-03-06 20:12
Here is a revised patch with a test case.  I've found another unicode charset bug in the code and it was fixed also.
File Added: email.1449244.patch
msg49735 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-03-13 10:24
Thanks for the patch. Committed as r54333 and r54334.
History
Date User Action Args
2022-04-11 14:56:15adminsetgithub: 43030
2006-03-13 23:55:15tkikuchicreate