X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=mimedecode.py;h=b82d12f96ee5dc945ebe593d3a2dd5c61026002b;hb=refs%2Ftags%2Fv2.3.2;hp=b1b18e3beab25ac36a34edf139097b1898400cfb;hpb=554b3f06f7f69d0f570ebac18b1d9161ac7ddf5f;p=mimedecode.git diff --git a/mimedecode.py b/mimedecode.py index b1b18e3..b82d12f 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -133,7 +133,6 @@ def set_content_type(msg, newtype, charset=None): msg.set_param("charset", charset, "Content-Type") - caps = None # Globally stored mailcap database; initialized only if needed def decode_body(msg, s): @@ -193,7 +192,7 @@ def totext(msg, instring): "Convert instring content to text" if msg.is_multipart(): # Recursively decode all parts of the multipart message - newfile = StringIO(str(msg)) + newfile = StringIO(msg.as_string()) newfile.seek(0) decode_file(newfile) return @@ -276,7 +275,7 @@ def decode_file(infile): decode_part(msg) else: # Not a message, just text - copy it literally - output(str(msg)) + output(msg.as_string()) class GlobalOptions: