Created
May 10, 2011 15:39
-
-
Save mrcaron/964703 to your computer and use it in GitHub Desktop.
Python UTF-16 to Ascii file converter
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
import codecs | |
import sys | |
import os | |
if __name__ == "__main__": | |
lines = '' | |
with codecs.open(sys.argv[1], 'r', 'utf-16') as f: | |
lines = f.read() | |
os.rename(sys.argv[1], sys.argv[1] + '_utf16') | |
with codecs.open(sys.argv[1], 'w', 'ascii') as w: | |
w.write(lines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment