[Email-SIG] set_payload() -- SF bug # 1409455
Tokio Kikuchi
tkikuchi at is.kochi-u.ac.jp
Wed Feb 8 00:51:50 CET 2006
Barry Warsaw wrote:
> On Feb 6, 2006, at 8:18 PM, Tokio Kikuchi wrote:
>
>> Hi again Barry,
>>
>> Tokio Kikuchi wrote:
>>
>>> Barry Warsaw wrote:
>>>
>>>> Mark Sapiro submitted SF bug #1409455 against email 2.5.
>>>>
>>>> https://sourceforge.net/tracker/index.php?
>>>> func=detail&aid=1409455&group_id=5470&atid=105470
>>>
>>> Hi, I am now testing the patch but it looks like it breaks some of
>>> japanese mail encoding rules, input/output charset conversion.
>>> I want to look at it closer but it may take some time because I'm busy
>>> this and next weeks on my students. :-(
>>
>>
>> This patch (in addition to the SF uploaded one) should be OK.
>>
>> --- /home/mailman/src/sf/mailman-2.1/misc/email-2.5.6/email/
>> Message.py Tue Feb 7 10:12:53 2006
>> +++ Message.py Tue Feb 7 09:55:55 2006
>> @@ -272,6 +272,8 @@
>> charset=charset.get_output_charset())
>> else:
>> self.set_param('charset', charset.get_output_charset())
>> + if str(charset) <> charset.get_output_charset():
>> + self._payload = charset.body_encode(self._payload)
>> if not self.has_key('Content-Transfer-Encoding'):
>> cte = charset.get_body_encoding()
>> if callable(cte):
>
>
> Hi Tokio,
>
> Thanks! Do you have a test case for this patch?
I've tested with mailman sending attachment email. A script like this
should be useful in testing the japanese spacial problem.
% cat testja.py
jhello = '\xa5\xcf\xa5\xed\xa1\xbc\xa5\xef\xa1\xbc\xa5\xeb\xa5\xc9\xa1\xaa'
jcode = 'euc-jp'
print jhello
import email.Message
m = email.Message.Message()
m.set_payload(jhello, jcode)
u = unicode(m.get_payload(), m.get_content_charset())
if jhello <> u.encode(jcode):
raise
print u.encode(jcode)
>
> If there are no objections, I'm going to apply these to 2.5.7 and 3.0.
>
> -Barry
>
>
>
--
Tokio Kikuchi, tkikuchi@ is.kochi-u.ac.jp
http://weather.is.kochi-u.ac.jp/
More information about the Email-SIG
mailing list