]> git.phdru.name Git - bookmarks_db.git/commitdiff
Create the list of charsets outside of the parsers test loop.
authorOleg Broytman <phd@phdru.name>
Mon, 3 Mar 2008 14:30:09 +0000 (14:30 +0000)
committerOleg Broytman <phd@phdru.name>
Mon, 3 Mar 2008 14:30:09 +0000 (14:30 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@186 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Robots/parse_html.py

index 038cfaf7aa3b0e51be09518f001c9abbda240808..b2ef61b53ce348ba73851d779942053775526ce6 100755 (executable)
@@ -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: