]> git.phdru.name Git - bookmarks_db.git/blobdiff - Robots/parse_html_beautifulsoup.py
Fixed a bug = meta_charset is True if HTTP charset is not guessed charset.
[bookmarks_db.git] / Robots / parse_html_beautifulsoup.py
index e0129fd1d4cb3c7b34f69f8c772946c04afab645..8c51d0500b6e78d19475f1b25e6c29c250b3c8c9 100644 (file)
@@ -23,9 +23,9 @@ def parse_html(filename, charset=None):
    root = BeautifulSoup(infile, fromEncoding=charset)
    infile.close()
 
-   charset = root.originalEncoding
+   _charset = root.originalEncoding
    try:
-      title = root.html.head.title.string.encode(charset)
+      title = root.html.head.title.string.encode(_charset)
    except AttributeError:
       title = ''
 
@@ -49,8 +49,7 @@ def parse_html(filename, charset=None):
       else:
          icon = None
 
-   parser = BSoupParser(charset, False, title, refresh, icon)
-   return parser
+   return BSoupParser(_charset, _charset != charset, title, refresh, icon)
 
 def _find_refresh(Tag):
    return (Tag.name == "meta") and \