aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2019-09-03 22:16:58 +0200
committerThomas Gleixner <tglx@linutronix.de>2019-09-03 22:16:58 +0200
commite6f724d324490f0c762816e7fd63865bd4a1fd7d (patch)
tree3faa57735a629d8dcb011a5597a406c7052b6a8c
parent9b978cc5594d93e899deac78e9415c6ce01d25f0 (diff)
downloadquilttools-e6f724d324490f0c762816e7fd63865bd4a1fd7d.tar.gz
mb2q: Feed the supplied character set into the decoder
Otherwise the decoder fails to handle especially asian character sets. Reported-by: Bjorn Helgaas <helgaas@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rwxr-xr-xmb2q9
1 files changed, 8 insertions, 1 deletions
diff --git a/mb2q b/mb2q
index 7e25b45..c93ba04 100755
--- a/mb2q
+++ b/mb2q
@@ -309,7 +309,14 @@ class patchmsg(object):
if not text:
continue
- text, patch = split_at_patch(text.decode())
+ try:
+ charset = part.get_content_charset('ascii')
+ text, patch = split_at_patch(text.decode(charset))
+ except:
+ err = 'Failed to decode body of Message-ID: %s\n' %self.msgid
+ sys.stderr.write(err)
+ return
+
self.text += text
if patch:
self.patch = patch