Revert "fix the cheap unicode escapes in GoogleTranslate"
unicode-escape appears to do bad things to hiragana and probably
all unicode characters that are not unicode escaped. ultimately
it seems that google's responses are not consistent.
back to the drawing board.
This reverts commit 40888869b0
.
This commit is contained in:
parent
02b3266b46
commit
3333fe125e
1
TODO
1
TODO
@ -10,6 +10,7 @@ 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
|
||||
* move the non-IRC things out of IrcAdmin
|
||||
* into DrBotIRC?
|
||||
|
@ -51,8 +51,14 @@ class GoogleTranslate(Module):
|
||||
end_idx = translation.find('"}, "')
|
||||
translation = translation[:end_idx]
|
||||
|
||||
# convert escaped unicode
|
||||
translation = translation.decode('unicode-escape', 'ignore')
|
||||
# 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;', '\'')
|
||||
|
||||
return self.reply(connection, replypath, translation)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user