From: Oleg Broytman Date: Thu, 28 Jul 2016 22:14:45 +0000 (+0300) Subject: Use bytes.decode() for Python 3 compatibility X-Git-Tag: 2.7.0~35 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=11c9d974852d4e643ee63bd4b26f8af6dcea7a41;p=mimedecode.git Use bytes.decode() for Python 3 compatibility --- diff --git a/mimedecode.py b/mimedecode.py index ce4b288..64e2184 100755 --- a/mimedecode.py +++ b/mimedecode.py @@ -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