handle unicode escapes the right way, now that i properly looked up what was going on
This commit is contained in:
parent
9eabef8abe
commit
9836ebf11f
11
dr.botzo.py
11
dr.botzo.py
|
@ -181,17 +181,10 @@ class GoogleTranslate(Module):
|
||||||
end_idx = translation.find('"}, "')
|
end_idx = translation.find('"}, "')
|
||||||
translation = translation[:end_idx]
|
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:
|
if replypath is None:
|
||||||
return translation
|
return translation.decode('unicode_escape')
|
||||||
else:
|
else:
|
||||||
connection.privmsg(replypath, translation)
|
connection.privmsg(replypath, translation.decode('unicode_escape'))
|
||||||
|
|
||||||
class Countdown(Module):
|
class Countdown(Module):
|
||||||
"""Class that adds a countdown item to the bot
|
"""Class that adds a countdown item to the bot
|
||||||
|
|
Loading…
Reference in New Issue