Created
February 23, 2014 17:20
-
-
Save tizoc/9174304 to your computer and use it in GitHub Desktop.
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 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