From a95546316ffe8707d0958540da5082ecb399816f Mon Sep 17 00:00:00 2001 From: Valentin Lorentz Date: Sat, 22 Sep 2012 17:34:33 +0000 Subject: [PATCH] Web: Fix title snarfer with titles containing unicode characters. --- plugins/Web/plugin.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/Web/plugin.py b/plugins/Web/plugin.py index 191e61212..d5262f3b6 100644 --- a/plugins/Web/plugin.py +++ b/plugins/Web/plugin.py @@ -29,6 +29,7 @@ ### import re +import sys import HTMLParser import htmlentitydefs @@ -105,6 +106,8 @@ class Web(callbacks.PluginRegexp): if parser.title: domain = utils.web.getDomain(url) title = utils.web.htmlToText(parser.title.strip()) + if sys.version_info[0] < 3: + title = title.encode('utf8', errors='replace') s = format(_('Title: %s (at %s)'), title, domain) irc.reply(s, prefixNick=False) titleSnarfer = urlSnarfer(titleSnarfer)