Skip to content

Instantly share code, notes, and snippets.

@elleryq
Created February 5, 2014 03:33
Show Gist options
  • Save elleryq/8817023 to your computer and use it in GitHub Desktop.
Save elleryq/8817023 to your computer and use it in GitHub Desktop.
Code clip from puddletag
# Contributed by Stjujsckij Nickolaj
def enconvert(text, enc_name):
''' Convert from non-standard encoding, "Convert to encoding: $0, Encoding: $1"
&Encoding, combo, cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256, cp1257, cp1258'''
return text.encode("latin1", 'replace').decode(enc_name, 'replace')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment