From: Oleg Broytman Date: Wed, 10 Oct 2007 16:18:01 +0000 (+0000) Subject: Use m_lib.defenc. X-Git-Tag: v4.5.3~295 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=f285d4493b2dbbd6350f0e4a51fbc69f08c92b3e;p=bookmarks_db.git Use m_lib.defenc. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@81 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Robots/parse_html.py b/Robots/parse_html.py index 6ec6336..25b3bb0 100755 --- a/Robots/parse_html.py +++ b/Robots/parse_html.py @@ -5,20 +5,10 @@ Written by BroytMann. Copyright (C) 1997-2007 PhiloSoft Design """ - -import sys -current_charset = sys.getdefaultencoding() -if current_charset == "ascii": - try: - import locale - except ImportError: - pass - else: - current_charset = locale.getpreferredencoding() -current_charset = current_charset.replace("windows-", "cp").lower() +from m_lib.defenc import default_encoding +current_charset = default_encoding.replace("windows-", "cp") DEFAULT_CHARSET = "cp1251" # Stupid default for Russian Cyrillic - from HTMLParser import HTMLParseError from m_lib.net.www.html import HTMLParser as _HTMLParser @@ -155,7 +145,6 @@ def parse_html(filename, charset=None, log=None): if __name__ == '__main__': - import sys parser = parse_html(sys.argv[1]) print parser.charset print parser.title