diff --git a/modules/GoogleTranslate.py b/modules/GoogleTranslate.py index c57aa38..bcb35d7 100644 --- a/modules/GoogleTranslate.py +++ b/modules/GoogleTranslate.py @@ -16,8 +16,6 @@ from urllib2 import urlopen from urllib import urlencode -from htmlentitydefs import name2codepoint -import re from extlib import irclib @@ -51,31 +49,13 @@ class GoogleTranslate(Module): translation = translation.decode('utf-8') # do some text conversion - for i in re.findall('\u(\w{4})', translation): - replacement = unichr(int(i, 16)) - translation = translation.replace('\u' + i, replacement) - - for i in re.findall('&(#)?(x)?(\w+?);', translation): - replacement = i[2] - if i[0] == "#": - if i[1] == 'x': - replacement = unichr(int(i[2], 16)) - else: - replacement = unichr(int(i[2])) - else: - cp = name2codepoint.get(i[2]) - replacement = unichr(cp) - translation = translation.replace('&' + i[0] + i[1] + i[2] + ';', replacement) - - translation = translation.replace('\\\\', '\\') - - #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;', '\'') + 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)