broken BOM handling html_file_open causes "HTML parser error : htmlParseStartTag: misplaced [...] tag" messages
action:
open a XHTML file (sample.html)
result:
data is imported as expected but causes unexpected messages on the console:
sample.html:2: HTML parser error : Misplaced DOCTYPE declaration sample.html:2: HTML parser error : htmlParseStartTag: misplaced sample.html:2: HTML parser error : htmlParseStartTag: misplaced
tag sample.html:21: HTML parser error : htmlParseStartTag: misplaced tag
cause:
html_file_open in plugins/html/html_read.c treats leading bytes as Byte Order Marks even if they aren't part of a BOM but actual content ("<?xm") thus using the wrong offset for htmlCreatePushParserCtxt
solution:
see attached html_bom_handling.patch
Since libxml 2.7.2 (Oct 3 2008) it is no longer necessary to remove BOMs thus the #if-#endif part can be removed for all non-ancient systems.