X-Git-Url: https://git.phdru.name/?p=mimedecode.git;a=blobdiff_plain;f=mimedecode.py;h=69af1ac984ffa78e71818f38cb5009c97a098be4;hp=0ec5e799fd22ce1ceb6071706729ea8f082b7f8a;hb=007287d33830efbbe7659e68fbf24769b926b31b;hpb=dbc1b161c526976b322f2fa9a7d2a75e3613485e diff --git a/mimedecode.py b/mimedecode.py index 0ec5e79..69af1ac 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -342,10 +342,12 @@ def _save_message(msg, outstring, save_headers=False, save_body=False): global output save_output = output outfile = open_output_file(fname) + def _output_bytes(s): if not isinstance(s, bytes): s = s.encode(g.default_encoding, "replace") outfile.write(s) + output = _output_bytes if save_headers: output_headers(msg)