From e1f509efe72b433fdedea7ef24526b09934768d2 Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Tue, 30 Mar 2021 12:32:42 -0700 Subject: Decode message bodies for replies in CommandRunner. --- Mailman/Queue/CommandRunner.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Mailman/Queue/CommandRunner.py') diff --git a/Mailman/Queue/CommandRunner.py b/Mailman/Queue/CommandRunner.py index 6ea50255..a2a9dab7 100644 --- a/Mailman/Queue/CommandRunner.py +++ b/Mailman/Queue/CommandRunner.py @@ -100,6 +100,9 @@ class Results: # E.g the outer Content-Type: was text/html return body = part.get_payload(decode=True) + if (part.get_content_charset(None)): + body = unicode(body, part.get_content_charset()).encode( + Utils.GetCharSet(self.msgdata['lang'])) # text/plain parts better have string payloads assert isinstance(body, StringType) or isinstance(body, UnicodeType) lines = body.splitlines() -- cgit v1.2.3 From ed0adf071ced3aef5799ab9d08503142553703af Mon Sep 17 00:00:00 2001 From: Mark Sapiro Date: Wed, 31 Mar 2021 14:56:21 -0700 Subject: Improve fix for lp:1921682. --- Mailman/Queue/CommandRunner.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Mailman/Queue/CommandRunner.py') diff --git a/Mailman/Queue/CommandRunner.py b/Mailman/Queue/CommandRunner.py index a2a9dab7..3c21065f 100644 --- a/Mailman/Queue/CommandRunner.py +++ b/Mailman/Queue/CommandRunner.py @@ -101,8 +101,10 @@ class Results: return body = part.get_payload(decode=True) if (part.get_content_charset(None)): - body = unicode(body, part.get_content_charset()).encode( - Utils.GetCharSet(self.msgdata['lang'])) + body = unicode(body, part.get_content_charset(), + errors='replace').encode( + Utils.GetCharSet(self.msgdata['lang']), + errors='replace') # text/plain parts better have string payloads assert isinstance(body, StringType) or isinstance(body, UnicodeType) lines = body.splitlines() -- cgit v1.2.3