From ec21c8cae10abf14dd429eee484af8dd0b1c4c24 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 21 Jul 2009 13:24:55 -0400 Subject: [PATCH] be-mbox-to-xml handles emails without explicit transfer encodings. --- interfaces/xml/be-mbox-to-xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interfaces/xml/be-mbox-to-xml b/interfaces/xml/be-mbox-to-xml index 840a2a6..75cfd2b 100755 --- a/interfaces/xml/be-mbox-to-xml +++ b/interfaces/xml/be-mbox-to-xml @@ -74,7 +74,10 @@ def comment_message_to_xml(message, fields=None): #assert charset == DEFAULT_ENCODING.lower(), \ # u"Unknown charset: %s" % charset - encoding = message[u'content-transfer-encoding'].lower() + if message[u'content-transfer-encoding'] == None: + encoding = DEFAULT_ENCODING + else: + encoding = message[u'content-transfer-encoding'].lower() body = message.get_payload(decode=True) # attempt to decode assert body != None, "Unable to decode?" if fields[u'content-type'].startswith(u"text/"): -- 2.26.2