+++ /dev/null
-#! /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"))