mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Web: Fix encoding issues in title snarfing and @title.
This commit is contained in:
parent
28cdbaf021
commit
22febc4a20
@ -92,8 +92,9 @@ class Web(callbacks.PluginRegexp):
|
|||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
size = conf.supybot.protocols.http.peekSize()
|
size = conf.supybot.protocols.http.peekSize()
|
||||||
text = utils.web.getUrl(url, size=size) \
|
text = utils.web.getUrl(url, size=size)
|
||||||
.decode('utf8')
|
if sys.version_info[0] >= 3:
|
||||||
|
text = text.encode('utf8', 'replace')
|
||||||
except utils.web.Error, e:
|
except utils.web.Error, e:
|
||||||
self.log.info('Couldn\'t snarf title of %u: %s.', url, e)
|
self.log.info('Couldn\'t snarf title of %u: %s.', url, e)
|
||||||
return
|
return
|
||||||
@ -182,8 +183,9 @@ class Web(callbacks.PluginRegexp):
|
|||||||
DCC, ...).
|
DCC, ...).
|
||||||
"""
|
"""
|
||||||
size = conf.supybot.protocols.http.peekSize()
|
size = conf.supybot.protocols.http.peekSize()
|
||||||
text = utils.web.getUrl(url, size=size) \
|
text = utils.web.getUrl(url, size=size)
|
||||||
.decode('utf8')
|
if sys.version_info[0] >= 3:
|
||||||
|
text = text.encode('utf8', 'replace')
|
||||||
parser = Title()
|
parser = Title()
|
||||||
try:
|
try:
|
||||||
parser.feed(text)
|
parser.feed(text)
|
||||||
|
Loading…
Reference in New Issue
Block a user