- if content and is_html:
- parser = parse_html(content, charset, self.log)
+ content_stripped = content.strip()
+ if content_stripped and is_html:
+ parser = parse_html(
+ content_stripped, charset, self.log)
+ if charset:
+ bookmark.charset = charset
+ elif parser and parser.meta_charset:
+ bookmark.charset = parser.meta_charset