Created
December 13, 2012 22:29
-
-
Save anonymous/4280664 to your computer and use it in GitHub Desktop.
Kill stupid smartquotes. (This code is an ugly hack but it works for Google Docs text exports.)
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
import sys | |
tr = [ | |
(u'\u2018', "`"), | |
(u'\u2019',"'"), | |
(u'\u201c', "``"), | |
(u'\u201d', "''") | |
] | |
s = sys.stdin.read().decode('utf8') | |
for a, b in tr: | |
s = s.replace(a, b) | |
sys.stdout.write(s.encode('latin1')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment