From ae234692fece76a64f3275948ab9b820f80606de Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 12 Aug 2010 15:15:38 +0000 Subject: [PATCH] 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 --- Robots/parse_html_beautifulsoup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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") -- 2.39.5