From 175409e0f4d3b619895b6339971543d28a14d1e1 Mon Sep 17 00:00:00 2001 From: tkikuchi <> Date: Tue, 19 Oct 2004 04:34:06 +0000 Subject: 923428 VERP subscription confirmations 960551 Bug: Plain digest with mixed charsets 995029 Patch against Mailman 2.1.5 release fixes bug #913397 --- Mailman/Handlers/ToDigest.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Mailman/Handlers/ToDigest.py') diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py index 2f64b369..9051e846 100644 --- a/Mailman/Handlers/ToDigest.py +++ b/Mailman/Handlers/ToDigest.py @@ -39,6 +39,7 @@ from email.MIMEText import MIMEText from email.MIMEMessage import MIMEMessage from email.Utils import getaddresses from email.Header import decode_header, make_header, Header +from email.Charset import Charset from Mailman import mm_cfg from Mailman import Utils @@ -137,9 +138,11 @@ def send_digests(mlist, mboxfp): def send_i18n_digests(mlist, mboxfp): mbox = Mailbox(mboxfp) - # Prepare common information + # Prepare common information (first lang/charset) lang = mlist.preferred_language lcset = Utils.GetCharSet(lang) + lcset_out = Charset(lcset).output_charset + # Common Information (contd) realname = mlist.real_name volume = mlist.volume issue = mlist.next_digest_number @@ -316,6 +319,10 @@ def send_i18n_digests(mlist, mboxfp): print >> plainmsg payload = msg.get_payload(decode=True)\ or msg.as_string().split('\n\n',1)[1] + mcset = msg.get_content_charset('') + if mcset and mcset <> lcset and mcset <> lcset_out: + payload = unicode(payload, mcset, 'replace' + ).encode(lcset, 'replace') print >> plainmsg, payload if not payload.endswith('\n'): print >> plainmsg -- cgit v1.2.3