Doc bug: include_meta_content_type doesn't
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Confirmed
|
Low
|
Unassigned |
Bug Description
The docs for lxml.html.tostring state:
if include_
It does not:
In [81]: new_doc = E.HTML(
In [85]: tostring(new_doc, encoding='utf-8', include_
Out[85]: '<html>
To get the meta tag, I have to create it explicity:
In [87]: new_doc = E.HTML(
Now tostring works the same, with or without include_
In [90]: tostring(new_doc, include_
Out[90]: '<html><head><meta content="text/html; charset=utf-8" http-equiv=
In [91]: tostring(new_doc, encoding='utf-8')
Out[91]: '<html><head><meta content="text/html; charset=utf-8" http-equiv=
Is this the proper way to create HTML with encoding specified using lxml?
Python : (2, 6, 5, 'final', 0)
lxml.etree : (2, 2, 4, 0)
libxml used : (2, 7, 6)
libxml compiled : (2, 7, 6)
libxslt used : (1, 1, 26)
libxslt compiled : (1, 1, 26)
I agree that this is a bit quirky. Basically, it simply runs some string post processing after serialisation and tries to strip the tag that way. The original intention was to deal with the <meta> tag that libxml2 explicitly generates in some cases. Apparently not in this case.
Looks like this feature needs a proper redesign at some point...