From 5f1535447c00f4e7cbf4036a4436cf1b96803061 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Tue, 2 Jul 2013 13:42:53 +0200 Subject: [PATCH] Web: Use @title's utf8 decoding in the snarfer. --- plugins/Web/plugin.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index f289cfdfd..055396c18 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -93,13 +93,15 @@ class Web(callbacks.PluginRegexp): try: size = conf.supybot.protocols.http.peekSize() text = utils.web.getUrl(url, size=size) - if sys.version_info[0] >= 3: - text = text.decode('utf8', 'replace') except utils.web.Error, e: self.log.info('Couldn\'t snarf title of %u: %s.', url, e) if self.registryValue('snarferReportIOExceptions', channel): irc.reply(url+" : "+utils.web.strError(e), prefixNick=False) return + try: + text = text.decode('utf8', 'replace') + except: + pass parser = Title() try: parser.feed(text)