Skip to content

Instantly share code, notes, and snippets.

View christiansacks's full-sized avatar
💭
:(){ :|: & };:

MeaTLoTioN christiansacks

💭
:(){ :|: & };:
View GitHub Profile
@christiansacks
christiansacks / utf82cp437.py
Last active March 25, 2022 01:09 — forked from inky/convert_nfo.py
Convert a file from UTF-8 to CP437.
#!/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)