Last active
August 22, 2019 19:54
-
-
Save mrsarm/b576353cd2a217da6cc23706c1153b1d to your computer and use it in GitHub Desktop.
Use: ./msdos2utf8.py OLD_DOS_FILE NEW_ENCODED_FILE
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/python3 | |
# | |
# Usage: ./msdos2utf8.py OLD_DOS_FILE NEW_ENCODED_FILE | |
# | |
# Creates a new file UTF-8 encoded, taking the input file as a file with old ASCII encoded used in MS-DOS systems. | |
# | |
# Try to replace 'cp437' with 'iso8859' if the new file isn't encoded properly | |
import sys | |
with open(sys.argv[1], encoding='cp437') as infile: | |
with open(sys.argv[2], 'w', encoding='utf8') as outfile: | |
outfile.write(infile.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment