if __name__ == '__main__':
import sys
- from m_lib.defenc import default_encoding
- current_charset = default_encoding.replace("windows-", "cp")
- parser = parse_html(sys.argv[1], universal_charset,
+ l = len(sys.argv)
+ if l == 3:
+ filename = sys.argv[1]
+ charset = sys.argv[2]
+ elif l == 2:
+ filename = sys.argv[1]
+ charset = universal_charset
+ else:
+ sys.exit("Usage: %s filename [charset]" % sys.argv[0])
+
+ parser = parse_html(filename, universal_charset,
log=lambda s: sys.stdout.write(s + '\n'))
print " refresh:", parser.refresh
print " icon :", parser.icon