From: Oleg Broytman Date: Mon, 3 Mar 2008 14:30:09 +0000 (+0000) Subject: Create the list of charsets outside of the parsers test loop. X-Git-Tag: v4.5.3~190 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=8e3453660b31d58dab53b49fa6764f7badb9b352;p=bookmarks_db.git 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 --- 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: