X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;ds=sidebyside;f=parse_html%2Fbkmk_ph_html5.py;h=53109be72fd761f874a92723f0eb4d606c47b11f;hb=063423482c00ffc97cb697d093fdbf0d39421b3c;hp=a4906288af13fe5da0cf3f24f39e30a010f7cbe7;hpb=80054d3bdcbde67d3b941e0b69b55ca4998f4673;p=bookmarks_db.git diff --git a/parse_html/bkmk_ph_html5.py b/parse_html/bkmk_ph_html5.py index a490628..53109be 100644 --- a/parse_html/bkmk_ph_html5.py +++ b/parse_html/bkmk_ph_html5.py @@ -4,7 +4,7 @@ This file is a part of Bookmarks database and Internet robot. """ __author__ = "Oleg Broytman " -__copyright__ = "Copyright (C) 2010-2012 PhiloSoft Design" +__copyright__ = "Copyright (C) 2010-2013 PhiloSoft Design" __license__ = "GNU GPL" __all__ = ['parse_html'] @@ -53,7 +53,7 @@ def parse_html(filename, charset=None, log=None): title = '' for node in head.childNodes: - if node.name == 'meta' and \ + if (node.name == 'meta') and \ ('http-equiv' in node.attributes) and \ (node.attributes['http-equiv'] == 'content-type'): meta_content = node.attributes['content'] @@ -65,6 +65,9 @@ def parse_html(filename, charset=None, log=None): meta_charset = False else: break + elif (node.name == 'meta') and ('charset' in node.attributes): + meta_charset = node.attributes['charset'].lower() + break if not charset: charset = parser.tokenizer.stream.charEncoding[0]