aboutsummaryrefslogtreecommitdiffstats
path: root/Mailman/Handlers/ToDigest.py
diff options
context:
space:
mode:
authorYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-11-30 10:32:25 +0900
committerYasuhito FUTATSUKI at POEM <futatuki@poem.co.jp>2016-11-30 10:32:25 +0900
commit30cd100c152244d5b7a35c1142ae8b0c72428971 (patch)
tree01632af6bdcab8e7ff9b3b1bbb5d188416bff344 /Mailman/Handlers/ToDigest.py
parentbe0b65acdeef0468d6bbf55cdec592990117e9d4 (diff)
parent62c260510d4918841d320d1dfc760238e87b8af6 (diff)
downloadmailman2-30cd100c152244d5b7a35c1142ae8b0c72428971.tar.gz
mailman2-30cd100c152244d5b7a35c1142ae8b0c72428971.tar.xz
mailman2-30cd100c152244d5b7a35c1142ae8b0c72428971.zip
Merge lp:mailman/2.1 up to 1686
Diffstat (limited to 'Mailman/Handlers/ToDigest.py')
-rw-r--r--Mailman/Handlers/ToDigest.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py
index 2027a46c..02965f82 100644
--- a/Mailman/Handlers/ToDigest.py
+++ b/Mailman/Handlers/ToDigest.py
@@ -1,4 +1,4 @@
-# Copyright (C) 1998-2013 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2016 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@@ -68,6 +68,17 @@ except NameError:
+def to_cset_out(text, lcset):
+ # Convert text from unicode or lcset to output cset.
+ ocset = Charset(lcset).get_output_charset() or lcset
+ if isinstance(text, unicode):
+ return text.encode(ocset, errors='replace')
+ else:
+ return text.decode(lcset, errors='replace').encode(ocset,
+ errors='replace')
+
+
+
def process(mlist, msg, msgdata):
# Short circuit non-digestable lists.
if not mlist.digestable or msgdata.get('isdigest'):
@@ -299,7 +310,7 @@ def send_i18n_digests(mlist, mboxfp):
if msgcount == 0:
# Why did we even get here?
return
- toctext = toc.getvalue()
+ toctext = to_cset_out(toc.getvalue(), lcset)
# MIME
tocpart = MIMEText(toctext, _charset=lcset)
tocpart['Content-Description']= _("Today's Topics (%(msgcount)d messages)")
@@ -412,7 +423,7 @@ def send_i18n_digests(mlist, mboxfp):
listname=mlist.internal_name(),
isdigest=True)
# RFC 1153
- rfc1153msg.set_payload(plainmsg.getvalue(), lcset)
+ rfc1153msg.set_payload(to_cset_out(plainmsg.getvalue(), lcset), lcset)
virginq.enqueue(rfc1153msg,
recips=plainrecips,
listname=mlist.internal_name(),