Web: Fix Python 3 compatibility.

This commit is contained in:
Valentin Lorentz 2013-01-06 17:06:26 +01:00
parent 8a8f380a6b
commit 603f44129d

View File

@ -94,7 +94,7 @@ class Web(callbacks.PluginRegexp):
size = conf.supybot.protocols.http.peekSize()
text = utils.web.getUrl(url, size=size)
if sys.version_info[0] >= 3:
text = text.encode('utf8', 'replace')
text = text.decode('utf8', 'replace')
except utils.web.Error, e:
self.log.info('Couldn\'t snarf title of %u: %s.', url, e)
return
@ -188,7 +188,7 @@ class Web(callbacks.PluginRegexp):
size = conf.supybot.protocols.http.peekSize()
text = utils.web.getUrl(url, size=size)
if sys.version_info[0] >= 3:
text = text.encode('utf8', 'replace')
text = text.decode('utf8', 'replace')
parser = Title()
try:
parser.feed(text)