Skip to content

Fixed #78: Remove encoding tag because lxml won't accept it for unicode - #97

Merged
codelucas merged 1 commit into
codelucas:python-2-headfrom
mhall1:ticket_78_python_2_head
Dec 27, 2014
Merged

Fixed #78: Remove encoding tag because lxml won't accept it for unicode#97
codelucas merged 1 commit into
codelucas:python-2-headfrom
mhall1:ticket_78_python_2_head

Conversation

@mhall1

@mhall1 mhall1 commented Dec 20, 2014

Copy link
Copy Markdown

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.

…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()
@codelucas

Copy link
Copy Markdown
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
@codelucas
codelucas merged commit 8477d34 into codelucas:python-2-head Dec 27, 2014
codelucas added a commit that referenced this pull request Dec 27, 2014
This was a very annoying bug in the past, which caused DOM parse failures:
Reference
#97
#78
@codelucas

Copy link
Copy Markdown
Owner

The python3 version has been merged into master! Check it out here:
800651c

I made some modifications as in python3 we need to handle a special case if the incoming HTML was a bytes string or just a str

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants