Fixed #78: Remove encoding tag because lxml won't accept it for unicode - #97
Merged
codelucas merged 1 commit intoDec 27, 2014
Merged
Conversation
…for unicode objects lxml apparently doesn't accept unicode objects with both an encoding specified and an encoding tag in the HTML document, because they're paranoid that the two won't match. Stripped encoding tag before calling lxml.html.fromstring()
Owner
|
Great find @mhall1, this will also be merged into master asap! |
codelucas
added a commit
that referenced
this pull request
Dec 27, 2014
Fixed #78: Remove encoding tag because lxml won't accept it for unicode
Owner
|
The python3 version has been merged into master! Check it out here: I made some modifications as in python3 we need to handle a special case if the incoming HTML was a |
bylava995
pushed a commit
to bylava995/newspaper
that referenced
this pull request
Jul 31, 2025
This was a very annoying bug in the past, which caused DOM parse failures: Reference codelucas/newspaper#97 codelucas/newspaper#78
jyodroide
pushed a commit
to jyodroide/livebarcodescan
that referenced
this pull request
Oct 6, 2025
This was a very annoying bug in the past, which caused DOM parse failures: Reference codelucas/newspaper#97 codelucas/newspaper#78
MishaLaskine
added a commit
to MishaLaskine/G2P_CN_HCSI
that referenced
this pull request
Jan 19, 2026
This was a very annoying bug in the past, which caused DOM parse failures: Reference codelucas/newspaper#97 codelucas/newspaper#78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
lxml apparently doesn't accept unicode objects with both an encoding specified and an encoding tag in the HTML document, because they're paranoid that the two won't match (why they can't just check whether they match, I have no idea). Stripped encoding tag before calling lxml.html.fromstring()
@codelucas, please merge this into master as well.