mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-26 20:59:27 +01:00
Web: Fix encoding issue on Python 2. Closes GH-1359.
This commit is contained in:
parent
624553c069
commit
0f82f89eec
@ -156,14 +156,20 @@ class Web(callbacks.PluginRegexp):
|
||||
'replace')
|
||||
except UnicodeDecodeError:
|
||||
pass
|
||||
parser = Title()
|
||||
if minisix.PY3 and isinstance(text, bytes):
|
||||
if raiseErrors:
|
||||
irc.error(_('Could not guess the page\'s encoding. (Try '
|
||||
'installing python-charade.)'), Raise=True)
|
||||
else:
|
||||
return None
|
||||
try:
|
||||
parser = Title()
|
||||
parser.feed(text)
|
||||
except UnicodeDecodeError:
|
||||
# Workaround for Python 2
|
||||
# https://github.com/ProgVal/Limnoria/issues/1359
|
||||
parser = Title()
|
||||
parser.feed(text.encode('utf8'))
|
||||
parser.close()
|
||||
title = utils.str.normalizeWhitespace(''.join(parser.data).strip())
|
||||
if title:
|
||||
|
Loading…
Reference in New Issue
Block a user