From: Oleg Broytman Date: Mon, 1 Aug 2016 22:20:10 +0000 (+0300) Subject: Decode parameters on output X-Git-Tag: 2.7.0~27 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=7e9054a5d0ac3fe950ae20b5cd730004e3c66579;p=mimedecode.git Decode parameters on output Python3's email doesn't allow to store non-unicode header parameters so decode parameters on output. --- diff --git a/mimedecode.py b/mimedecode.py index 62097e4..25d3db0 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -32,7 +32,11 @@ def output_headers(msg): for key, value in msg.items(): output(key) output(": ") - output(value) + value = value.split(';', 1) + output(value[0]) + if len(value) == 2: + output(";") + output(_decode_header(value[1], strip=False)) output(os.linesep) output(os.linesep) # End of headers