Web: Add explicit error when page encoding cannot be guessed.

This commit is contained in:
Valentin Lorentz 2014-10-13 01:13:15 +00:00
parent d2046a81a2
commit 8ab29fb291
1 changed files with 4 additions and 1 deletions

View File

@ -270,9 +270,12 @@ class Web(callbacks.PluginRegexp):
try:
text = text.decode(utils.web.getEncoding(text) or 'utf8',
'replace')
except:
except UnicodeDecodeError:
pass
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:
parser.feed(text)
except HTMLParser.HTMLParseError: