From 918092a54d815803d7d5a2e8b0f0de18e3c229d8 Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 5 Jan 2013 18:02:35 +0100 Subject: [PATCH] Web: Fix snarfing of titles with UTF-8 characters. --- plugins/Web/plugin.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index 0abb9ed51..c85af765b 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -108,7 +108,10 @@ class Web(callbacks.PluginRegexp): domain = utils.web.getDomain(url) title = utils.web.htmlToText(parser.title.strip()) if sys.version_info[0] < 3: - title = title.encode('utf8', 'replace') + try: + title = title.encode('utf8', 'replace') + except UnicodeDecodeError: + pass s = format(_('Title: %s (at %s)'), title, domain) irc.reply(s, prefixNick=False) titleSnarfer = urlSnarfer(titleSnarfer)