Truncated serialized value (etree.tostring) for long tag value and encoding != 'utf-8'
Bug #1893462 reported by
Marcin Raczyński
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lxml |
Triaged
|
Undecided
|
Unassigned |
Bug Description
Function etree.tostring(xml, encoding=ENC) returns a serialized XML with a truncated tag value when the encoding is other than 'utf-8' and an XML has a tag with a long text value.
Failing test:
from lxml import etree
N = 5000
xml = etree.Element('x')
xml.text = 'a' * N
out_str = etree.tostring(xml, encoding=
assert len(out_str) > N
Python : sys.version_
lxml.etree : (4, 5, 2, 0)
libxml used : (2, 9, 10)
libxml compiled : (2, 9, 10)
libxslt used : (1, 1, 34)
libxslt compiled : (1, 1, 34)
description: | updated |
description: | updated |
summary: |
- Invalid serialization (etree.tostring) for long tag value and encoding - != 'utf-8' + Truncated serialized value (etree.tostring) for long tag value and + encoding != 'utf-8' |
To post a comment you must log in.
Bug was introduced in lxml 5.0.0 (in last 4.4.x version or 4.4.3 is ok)