@@ -18,22 +18,22 @@ def __iter__(self):
1818
1919 elif type == "EmptyTag" :
2020 if token ["name" ].lower () == "meta" :
21- # replace charset with actual encoding
22- has_http_equiv_content_type = False
21+ # replace charset with actual encoding
22+ has_http_equiv_content_type = False
2323 content_index = - 1
24- for i ,(name ,value ) in enumerate (token ["data" ]):
24+ for i ,(name ,value ) in enumerate (token ["data" ]):
2525 if name .lower () == 'charset' :
2626 token ["data" ][i ] = (u'charset' , self .encoding )
27- meta_found = True
28- break
29- elif name == 'http-equiv' and value .lower () == 'content-type' :
30- has_http_equiv_content_type = True
31- elif name == 'content' :
32- content_index = i
33- else :
34- if has_http_equiv_content_type and content_index >= 0 :
35- token ["data" ][content_index ] = (u'content' , u'text/html; charset=%s' % self .encoding )
36- meta_found = True
27+ meta_found = True
28+ break
29+ elif name == 'http-equiv' and value .lower () == 'content-type' :
30+ has_http_equiv_content_type = True
31+ elif name == 'content' :
32+ content_index = i
33+ else :
34+ if has_http_equiv_content_type and content_index >= 0 :
35+ token ["data" ][content_index ] = (u'content' , u'text/html; charset=%s' % self .encoding )
36+ meta_found = True
3737
3838 elif token ["name" ].lower () == "head" and not meta_found :
3939 # insert meta into empty head
0 commit comments