Encoding issues with python's etree.tostring
etree.tostring(elem, encoding=str)
will return str
but not binary
in Python 3
You can also serialise to a Unicode string without declaration by passing the
unicode
function as encoding (orstr
in Py3), or the name 'unicode'. This changes the return value from a byte string to an unencoded unicode string.