Last active
August 29, 2015 14:06
-
-
Save hkulekci/ac6d75c4f5ec82dfffe2 to your computer and use it in GitHub Desktop.
subtitle encoding fix
This file contains 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/python | |
# coding=utf-8 | |
import os | |
import sys | |
import codecs | |
args = sys.argv | |
file = "" | |
encoding = 'iso-8859-9' | |
if len(args) == 2: | |
file = args[1] | |
elif len(args) == 3: | |
encoding = args[1] | |
file = args[2] | |
f = codecs.open(file, 'r', encoding) | |
text = f.read() | |
out = codecs.open(file, 'w', 'utf-8') | |
out.write(text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment