X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=blobdiff_plain;f=bin%2Ficonvxml.py;fp=bin%2Ficonvxml.py;h=0000000000000000000000000000000000000000;hp=2892a919d70195bcebb0f62ad55277f915f844a3;hb=638bc28e9d4294118b5484d2c22dd1d88e0d07fc;hpb=210cd046d06e1b007c9e9fc89d399e9e3d2a9ce2 diff --git a/bin/iconvxml.py b/bin/iconvxml.py deleted file mode 100755 index 2892a91..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(line.decode(from_charset, "replace").encode(to_charset, "xmlcharrefreplace")) - except: - infile.close() -else: - for line in sys.stdin: - sys.stdout.write(line.decode(from_charset, "replace").encode(to_charset, "xmlcharrefreplace"))