[Email-SIG] set_payload() -- SF bug # 1409455 (original) (raw)
Tokio Kikuchi tkikuchi at is.kochi-u.ac.jp
Wed Feb 8 00:51:50 CET 2006
- Previous message: [Email-SIG] set_payload() -- SF bug # 1409455
- Next message: [Email-SIG] set_payload() -- SF bug # 1409455
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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&groupid=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.getoutputcharset()) else: self.setparam('charset', charset.getoutputcharset()) + if str(charset) <> charset.getoutputcharset(): + self.payload = charset.bodyencode(self.payload) if not self.haskey('Content-Transfer-Encoding'): cte = charset.getbodyencoding() 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/
- Previous message: [Email-SIG] set_payload() -- SF bug # 1409455
- Next message: [Email-SIG] set_payload() -- SF bug # 1409455
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]