def parse_html(html_text, charset=None, log=None):
- if not parsers:
+ if not html_text or not parsers:
return None
if charset:
# parser.charset = 'ascii'
converted_title = title = parser.title
- if title and (not parser.charset):
+ if title and isinstance(title, bytes) and (not parser.charset):
try:
title.decode("ascii")
except UnicodeDecodeError: