From 8e3453660b31d58dab53b49fa6764f7badb9b352 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 3 Mar 2008 14:30:09 +0000 Subject: [PATCH] Create the list of charsets outside of the parsers test loop. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@186 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Robots/parse_html.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Robots/parse_html.py b/Robots/parse_html.py index 038cfaf..b2ef61b 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -57,10 +57,13 @@ def parse_html(filename, charset=None, log=None): except (ValueError, LookupError): charset = None # ...try charset from HTML - for p in parsers: - charsets = [universal_charset, DEFAULT_CHARSET] + charsets = [universal_charset, DEFAULT_CHARSET] + if charset: + charset = charset.lower() if charset not in charsets: charsets.insert(0, charset) + + for p in parsers: parser = None for c in charsets: try: -- 2.39.2