@@ -55,7 +55,7 @@ def parse():
5555
5656 tokenizer = HTMLTokenizer
5757
58- p = html5parser .HTMLParser (tree = treebuilder , tokenizer = tokenizer , debug = opts .log )
58+ p = html5parser .HTMLParser (tree = treebuilder , debug = opts .log )
5959
6060 if opts .fragment :
6161 parseMethod = p .parseFragment
@@ -96,7 +96,7 @@ def parse():
9696
9797def run (parseMethod , f , encoding , scripting ):
9898 try :
99- document = parseMethod (f , encoding = encoding , scripting = scripting )
99+ document = parseMethod (f , override_encoding = encoding , scripting = scripting )
100100 except :
101101 document = None
102102 traceback .print_exc ()
@@ -117,16 +117,14 @@ def printOutput(parser, document, opts):
117117 document .writexml (sys .stdout , encoding = "utf-8" )
118118 elif tb == "lxml" :
119119 import lxml .etree
120- sys .stdout .write (lxml .etree .tostring (document ))
120+ sys .stdout .write (lxml .etree .tostring (document , encoding = "unicode" ))
121121 elif tb == "etree" :
122- sys .stdout .write (utils .default_etree .tostring (document ))
122+ sys .stdout .write (utils .default_etree .tostring (document , encoding = "unicode" ))
123123 elif opts .tree :
124124 if not hasattr (document , '__getitem__' ):
125125 document = [document ]
126126 for fragment in document :
127127 print (parser .tree .testSerializer (fragment ))
128- elif opts .hilite :
129- sys .stdout .write (document .hilite ("utf-8" ))
130128 elif opts .html :
131129 kwargs = {}
132130 for opt in serializer .HTMLSerializer .options :
@@ -188,9 +186,6 @@ def getOptParser():
188186 parser .add_option ("" , "--no-html" , action = "store_false" , default = True ,
189187 dest = "html" , help = "Don't output html" )
190188
191- parser .add_option ("" , "--hilite" , action = "store_true" , default = False ,
192- dest = "hilite" , help = "Output as formatted highlighted code." )
193-
194189 parser .add_option ("-c" , "--encoding" , action = "store_true" , default = False ,
195190 dest = "encoding" , help = "Print character encoding used" )
196191
0 commit comments