From: Oleg Broytman Date: Thu, 12 Aug 2010 15:15:38 +0000 (+0000) Subject: Fixed a bug - don't do a double encode. X-Git-Tag: v4.5.3~105 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=ae234692fece76a64f3275948ab9b820f80606de;p=bookmarks_db.git Fixed a bug - don't do a double encode. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@271 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/parse_html_beautifulsoup.py b/Robots/parse_html_beautifulsoup.py index a7df16f..1fa4dc3 100644 --- a/Robots/parse_html_beautifulsoup.py +++ b/Robots/parse_html_beautifulsoup.py @@ -81,7 +81,7 @@ def parse_html(filename, charset=None, log=None): return None if title.string: - title = title.string.encode(_charset) + title = title.string else: parts = [] for part in title: @@ -90,6 +90,9 @@ def parse_html(filename, charset=None, log=None): parts.append(part.strip()) title = ''.join(parts) + if _charset or meta_charset: + title = title.encode(_charset or meta_charset) + meta = head.find(_find_contenttype, recursive=False) if meta: try: @@ -105,9 +108,6 @@ def parse_html(filename, charset=None, log=None): else: meta_charset = False - if charset or meta_charset: - title = title.encode(charset or meta_charset) - meta = head.find(_find_refresh, recursive=False) if meta: refresh = meta.get("content")