Skip to content

Instantly share code, notes, and snippets.

@hkulekci
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hkulekci/ac6d75c4f5ec82dfffe2 to your computer and use it in GitHub Desktop.
Save hkulekci/ac6d75c4f5ec82dfffe2 to your computer and use it in GitHub Desktop.
subtitle encoding fix
#!/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