This commit is contained in:
Kovid Goyal 2008-10-07 18:06:57 -07:00
parent 20f608294d
commit 2b0cf3fed5

View File

@ -436,6 +436,7 @@ class Parser(PreProcessor, LoggingInterface):
''' Create lxml ElementTree from HTML '''
self.log_info('\tParsing '+os.sep.join(self.htmlfile.path.split(os.sep)[-3:]))
src = open(self.htmlfile.path, 'rb').read().decode(self.htmlfile.encoding, 'replace').strip()
src = src[src.find('<'):]
src = self.preprocess(src)
# lxml chokes on unicode input when it contains encoding declarations
for pat in ENCODING_PATS: