]> git.phdru.name Git - mimedecode.git/commitdiff
Use bytes.decode() for Python 3 compatibility
authorOleg Broytman <phd@phdru.name>
Thu, 28 Jul 2016 22:14:45 +0000 (01:14 +0300)
committerOleg Broytman <phd@phdru.name>
Thu, 28 Jul 2016 22:14:45 +0000 (01:14 +0300)
mimedecode.py

index ce4b288627ca1b565b0134614f9b97cfcf6349de..64e2184e5b978bc3f70455fe360c98658a8d321a 100755 (executable)
@@ -35,7 +35,7 @@ def output_headers(msg):
 
 def recode_if_needed(s, charset):
     if charset and charset.lower() != g.default_encoding:
-        s = unicode(s, charset, "replace").encode(g.default_encoding, "replace")
+        s = s.decode(charset, "replace").encode(g.default_encoding, "replace")
     return s