]> git.phdru.name Git - mimedecode.git/commitdiff
Fix(Python2): Do not decode bytes to unicode
authorOleg Broytman <phd@phdru.name>
Sat, 13 May 2017 11:54:49 +0000 (14:54 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 13 May 2017 11:54:49 +0000 (14:54 +0300)
mimedecode.py
test/expected/msg_10.txt

index 5d58333e51350c03077d90a053e29137a20e18d2..3b1df3e233dea79d8dd4f4b4b3425b883b6b51e5 100755 (executable)
@@ -243,7 +243,7 @@ def decode_body(msg, s):
         return s
 
     outfile = open(filename, 'wb')
-    if charset and isinstance(s, bytes):
+    if charset and bytes is not str and isinstance(s, bytes):  # Python3
         s = s.decode(charset, "replace")
     if not isinstance(s, bytes):
         s = s.encode(g.default_encoding, "replace")
index 01dab932f78fc7531b951047c780ab701309b021..e59a81be03acc57caba8a82ac49afe52f4e64918 100644 (file)
@@ -22,7 +22,7 @@ MIME-Version: 1.0
 Content-Type: text/plain; charset="utf-8"
 X-MIME-Autoconverted: from iso-8859-1 to utf-8 by test id mimedecode.py
 
-¡This is a Quoted Printable encoded message!
+¡This is a Quoted Printable encoded message!
 
 
 --BOUNDARY