Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Consistent content of html with CJK #32

Closed
winterjung opened this issue Feb 27, 2018 · 1 comment
Closed

Suggestion: Consistent content of html with CJK #32

winterjung opened this issue Feb 27, 2018 · 1 comment

Comments

@winterjung
Copy link
Contributor

Details of suggestion

In latest version that not yet released, requests_html.HTML.html works fine. But requests_html.Element.html works weird in CJK. I think cause of this happen is html property with default ASCII encoding in etree.tostring()

Problem

>>> import requests_html
>>> doc = '<div>한글<p>한글CJK</p></div>'
>>> page = requests_html.HTML(html=doc, url='fake_url')
>>> page.html
'<div>한글<p>한글CJK</p></div>'
>>> div = page.find('div', first=True)
>>> div
<Element 'div' >
>>> div.html
'<div>&#54620;&#44544;<p>&#54620;&#44544;CJK</p></div>'
>>> div.text
'한글\n한글CJK'

Expected behaviour

>>> doc = '<div>한글<p>한글CJK</p></div>'
>>> page = requests_html.HTML(html=doc, url='fake_url')
>>> page.html
'<div>한글<p>한글CJK</p></div>'
>>> div = page.find('div', first=True)
>>> div.html
'<div>한글<p>한글CJK</p></div>'

I'll work on it to fix this issue.

@kennethreitz
Copy link
Collaborator

v0.3.4 released, which fixes this

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

No branches or pull requests

2 participants