Web: Fix snarfing of titles with UTF-8 characters.

This commit is contained in:
Valentin Lorentz 2013-01-05 18:02:35 +01:00
parent f9e8c35f01
commit 918092a54d

View File

@ -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:
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)