From 7e9054a5d0ac3fe950ae20b5cd730004e3c66579 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 2 Aug 2016 01:20:10 +0300 Subject: [PATCH] Decode parameters on output Python3's email doesn't allow to store non-unicode header parameters so decode parameters on output. --- mimedecode.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 -- 2.39.5