fix the cheap unicode escapes in GoogleTranslate
This commit is contained in:
parent
b487caf12d
commit
40888869b0
1
TODO
1
TODO
@ -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
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user