From 983c1a3fb43179ad781cee37cc6c9d8a3d4aa178 Mon Sep 17 00:00:00 2001 From: tkikuchi <> Date: Wed, 1 Dec 2004 05:11:39 +0000 Subject: Precautions against 'charset=' (empty) message. --- Mailman/Cgi/admindb.py | 2 +- Mailman/Handlers/Decorate.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Mailman/Cgi/admindb.py b/Mailman/Cgi/admindb.py index 248f7657..38d08a2c 100644 --- a/Mailman/Cgi/admindb.py +++ b/Mailman/Cgi/admindb.py @@ -609,7 +609,7 @@ def show_post_requests(mlist, id, info, total, count, form): if mcset <> lcset: try: body = unicode(body, mcset).encode(lcset) - except (LookupError, UnicodeError): + except (LookupError, UnicodeError, ValueError): pass hdrtxt = NL.join(['%s: %s' % (k, v) for k, v in msg.items()]) hdrtxt = Utils.websafe(hdrtxt) diff --git a/Mailman/Handlers/Decorate.py b/Mailman/Handlers/Decorate.py index b9932a27..64ba8155 100644 --- a/Mailman/Handlers/Decorate.py +++ b/Mailman/Handlers/Decorate.py @@ -82,7 +82,10 @@ def process(mlist, msg, msgdata): # safely add the header/footer to a plain text message since all # charsets Mailman supports are strict supersets of us-ascii -- # no, UTF-16 emails are not supported yet. - mcset = msg.get_content_charset('us-ascii') + # + # TK: Message with 'charset=' cause trouble. So, instead of + # mgs.get_content_charset('us-ascii') ... + mcset = msg.get_content_charset() or 'us-ascii' lcset = Utils.GetCharSet(mlist.preferred_language) msgtype = msg.get_content_type() # BAW: If the charsets don't match, should we add the header and footer by -- cgit v1.2.3