]> git.phdru.name Git - dotfiles.git/blobdiff - bin/iconv.py
Adapt Python scripts to Python 3
[dotfiles.git] / bin / iconv.py
index 41631fea5bd449cd6128f4a33adbe5835c8bb8ac..83de413dc373ac5093e3cedfd971870676dbe6d9 100755 (executable)
@@ -20,9 +20,9 @@ if arguments:
       infile = open(file)
       try:
          for line in infile:
-            sys.stdout.write(unicode(line, from_charset, "replace").encode(to_charset, "replace"))
+            sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "replace"))
       except:
          infile.close()
 else:
    for line in sys.stdin:
-      sys.stdout.write(unicode(line, from_charset, "replace").encode(to_charset, "replace"))
+      sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "replace"))