-
-
Save christiansacks/ebead3004aac0b24fb4a763e0f19eec6 to your computer and use it in GitHub Desktop.
Convert a file from UTF-8 to CP437.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import codecs, sys | |
try: | |
infile, outfile = sys.argv[1], sys.argv[2] | |
except IndexError: | |
sys.stderr.write('usage: %s input_file output_file\n' % sys.argv[0]) | |
sys.exit(1) | |
nfo = codecs.open(infile, encoding='utf-8').read() | |
codecs.open(outfile, 'w', encoding='cp437', errors='replace').write(nfo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment