mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-04 08:34:11 +01:00
Web: Add explicit error when page encoding cannot be guessed.
This commit is contained in:
parent
d2046a81a2
commit
8ab29fb291
@ -270,9 +270,12 @@ class Web(callbacks.PluginRegexp):
|
|||||||
try:
|
try:
|
||||||
text = text.decode(utils.web.getEncoding(text) or 'utf8',
|
text = text.decode(utils.web.getEncoding(text) or 'utf8',
|
||||||
'replace')
|
'replace')
|
||||||
except:
|
except UnicodeDecodeError:
|
||||||
pass
|
pass
|
||||||
parser = Title()
|
parser = Title()
|
||||||
|
if sys.version_info[0] >= 3 and isinstance(text, bytes):
|
||||||
|
irc.error(_('Could not guess the page\'s encoding. (Try '
|
||||||
|
'installing python-charade'), Raise=True)
|
||||||
try:
|
try:
|
||||||
parser.feed(text)
|
parser.feed(text)
|
||||||
except HTMLParser.HTMLParseError:
|
except HTMLParser.HTMLParseError:
|
||||||
|
Loading…
Reference in New Issue
Block a user