diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2021-05-19 15:04:14 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2021-05-19 15:06:11 +0200 |
commit | 6321f9de9b3cdca136bce63ea40816e077b9005f (patch) | |
tree | 4b6162209382361bd3903b781380f8ad71bccbff | |
parent | ee05daf1094997b62ed34092abd8607a8efb2485 (diff) | |
download | python-lxml-6321f9de9b3cdca136bce63ea40816e077b9005f.tar.gz |
Avoid direct C-API call.
-rw-r--r-- | src/lxml/serializer.pxi | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/lxml/serializer.pxi b/src/lxml/serializer.pxi index d66f59a7..e5cd3674 100644 --- a/src/lxml/serializer.pxi +++ b/src/lxml/serializer.pxi @@ -68,8 +68,7 @@ cdef _textToString(xmlNode* c_node, encoding, bint with_tail): needs_conversion = 1 if needs_conversion: - text = python.PyUnicode_DecodeUTF8( - <const_char*>c_text, tree.xmlBufferLength(c_buffer), 'strict') + text = (<const_char*>c_text)[:tree.xmlBufferLength(c_buffer)].decode('utf8') if encoding is not unicode: encoding = _utf8(encoding) text = python.PyUnicode_AsEncodedString( |