From 3cb1b83ad134cc67669ff52cfed5662c80bbade4 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 3 Mar 2008 17:50:06 +0000 Subject: [PATCH] Charset was guessed if it is not from META and not from HTTP. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@189 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Robots/parse_html.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Robots/parse_html.py b/Robots/parse_html.py index b2ef61b..ec93ea5 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -59,7 +59,7 @@ def parse_html(filename, charset=None, log=None): charsets = [universal_charset, DEFAULT_CHARSET] if charset: - charset = charset.lower() + charset = charset.lower().replace("windows-", "cp") if charset not in charsets: charsets.insert(0, charset) @@ -84,13 +84,13 @@ def parse_html(filename, charset=None, log=None): parser.charset = DEFAULT_CHARSET if parser.charset: - parser.charset = parser.charset.replace("windows-", "cp").lower() + parser.charset = parser.charset.lower().replace("windows-", "cp") if parser.charset and (parser.charset <> universal_charset): try: if parser.meta_charset: if log: log(" META charset : %s" % parser.charset) - else: + elif (not charset) or charset <> parser.charset: if log: log(" guessed charset: %s" % parser.charset) if log: log(" current charset: %s" % universal_charset) if log: log(" title : %s" % title) -- 2.39.5