Skip to content

Instantly share code, notes, and snippets.

@tizoc
Created February 23, 2014 17:20
Show Gist options
  • Save tizoc/9174304 to your computer and use it in GitHub Desktop.
Save tizoc/9174304 to your computer and use it in GitHub Desktop.
import re
pattern = re.compile(r'\\\'([0-9a-fA-F]{2})')
def fix(s):
return unicode(chr(int(s.group(1), base=16)), encoding='mac_roman')
s = unicode(
r"\'f2ltimo d\'92a de las negociaciones por Siria, que se reanudar\'87n el 10 de febrero")
print re.sub(pattern, fix, s)
# faust /tmp > python test.py
# Último día de las negociaciones por Siria, que se reanudarán el 10 de febrero
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment