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
if __name__ == '__main__':
- import sys
parser = parse_html(sys.argv[1])
print parser.charset
print parser.title