etree.htmlfile doesn't escape attribute values
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
>>> from lxml import etree
>>> etree.LXML_VERSION
(3, 6, 0, 0)
>>>
>>> from lxml import html
>>> from lxml.etree import htmlfile
>>> from lxml.html.builder import E
>>> from StringIO import StringIO
>>> out = StringIO()
>>> with htmlfile(out) as f:
... with f.element(
... f.write("foo")
...
>>> out.getvalue()
'<tagname attr=""
>>> import sys
>>> from lxml import etree
>>>
Python : sys.version_
lxml.etree : (3, 6, 0, 0)
libxml used : (2, 9, 3)
libxml compiled : (2, 9, 3)
libxslt used : (1, 1, 28)
libxslt compiled : (1, 1, 28)
summary: |
- etree.htmlfile misquotes attributes + etree.htmlfile doesn't escape attribute values |
Expected output:
'<tagname attr="& quot;misquoted& quot;"> foo</tagname> '