fix the cheap unicode escapes in GoogleTranslate

This commit is contained in:
Brian S. Stephan 2011-01-06 22:53:21 -06:00
parent b487caf12d
commit 40888869b0
2 changed files with 2 additions and 9 deletions

1
TODO
View File

@ -11,5 +11,4 @@ dr.botzo --- TODO
* obligatory info command
* settle on docstrings: http://www.python.org/dev/peps/pep-0257/
* voice survivor --- track how long users have voice, score them somehow
* fix the cheap unicode escapes in GoogleTranslate
* periodic reconnects when disconnected/split

View File

@ -43,14 +43,8 @@ class GoogleTranslate(Module):
end_idx = translation.find('"}, "')
translation = translation[:end_idx]
# do some text conversion
translation = translation.replace('\\u0026quot;', '"')
translation = translation.replace('\\u0026amp;', '&')
translation = translation.replace('\\u003c', '<')
translation = translation.replace('\\u0026lt;', '<')
translation = translation.replace('\\u003e', '>')
translation = translation.replace('\\u0026gt;', '>')
translation = translation.replace('\\u0026#39;', '\'')
# convert escaped unicode
translation = translation.decode('unicode-escape', 'ignore')
return self.reply(connection, replypath, translation)