X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=blobdiff_plain;f=bin%2Ficonvxml.py;h=2892a919d70195bcebb0f62ad55277f915f844a3;hp=86eb66dbad906fc388f6c85ccc92d5dd8a446b2c;hb=HEAD;hpb=c5883d2a782366c0a3468a989e756cf37dabbd46 diff --git a/bin/iconvxml.py b/bin/iconvxml.py deleted file mode 100755 index 86eb66d..0000000 --- a/bin/iconvxml.py +++ /dev/null @@ -1,28 +0,0 @@ -#! /usr/bin/env python -"Recode using XML char references" - -import sys -from getopt import getopt -from m_lib.defenc import default_encoding - -from_charset = "utf-8" -to_charset = default_encoding - -options, arguments = getopt(sys.argv[1:], 'f:t:') -for option, value in options: - if option == '-f': - from_charset = value - elif option == '-t': - to_charset = value - -if arguments: - for file in arguments: - infile = open(file) - try: - for line in infile: - sys.stdout.write(unicode(line, from_charset, "replace").encode(to_charset, "xmlcharrefreplace")) - except: - infile.close() -else: - for line in sys.stdin: - sys.stdout.write(unicode(line, from_charset, "replace").encode(to_charset, "xmlcharrefreplace"))