Revert "handle unicode escapes the right way, now that i properly looked up what was going on" because it turns out that result languages like ja mix the escaped unicode and the natural unicode and that screws up every method i've found to parse so far, as they all appear to expect all escaped or all native. here's an example:

\u0026lt;ハイテク\u0026gt;

if you can figure that out, un-revert and apply your fix.

This reverts commit 9836ebf11f.
This commit is contained in:
Brian S. Stephan 2010-07-26 20:48:54 -05:00
parent 22c423f8b5
commit 497554c314
1 changed files with 9 additions and 2 deletions

View File

@ -181,10 +181,17 @@ 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('\\u003e', '>')
translation = translation.replace('\\u0026#39;', '\'')
if replypath is None:
return translation.decode('unicode_escape')
return translation
else:
connection.privmsg(replypath, translation.decode('unicode_escape'))
connection.privmsg(replypath, translation)
class Countdown(Module):
"""Class that adds a countdown item to the bot