]> git.phdru.name Git - mimedecode.git/commitdiff
Inline recode
authorOleg Broytman <phd@phdru.name>
Thu, 13 Mar 2014 00:00:59 +0000 (04:00 +0400)
committerOleg Broytman <phd@phdru.name>
Thu, 13 Mar 2014 00:00:59 +0000 (04:00 +0400)
mimedecode.py

index 1006fb47768d8c9efc6c225eab9e8ebead50c2c9..e63aedcc8664c82bdf89ae915d3ac59666e2c4a0 100755 (executable)
@@ -34,12 +34,9 @@ def output_headers(msg):
     output("\n") # End of headers
 
 
-def recode(s, charset):
-    return unicode(s, charset, "replace").encode(g.default_encoding, "replace")
-
 def recode_if_needed(s, charset):
     if charset and charset.lower() <> g.default_encoding:
-        s = recode(s, charset)
+        s = unicode(s, charset, "replace").encode(g.default_encoding, "replace")
     return s