You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The module is not able to handle input with non-ASCII characters. If unicode is passed, the str() conversion on most of the parameters throws UnicodeEncodeErrors as the Python default encoding of ASCII is not able to handle the non-ASCII characters.
If UTF-8 encoded strings are passed, etree's element.tostring() method is expecting unicode and tries to encode it:
File "C:\python27\lib\site-packages\junit_xml\__init__.py", line 169, in to_xml_string
xml_string = ET.tostring(xml_element, encoding=encoding)
File "C:\python27\lib\xml\etree\ElementTree.py", line 1126, in tostring
ElementTree(element).write(file, encoding, method=method)
File "C:\python27\lib\xml\etree\ElementTree.py", line 820, in write
serialize(write, self._root, encoding, qnames, namespaces)
File "C:\python27\lib\xml\etree\ElementTree.py", line 939, in _serialize_xml
_serialize_xml(write, e, encoding, qnames, None)
File "C:\python27\lib\xml\etree\ElementTree.py", line 932, in _serialize_xml
v = _escape_attrib(v, encoding)
File "C:\python27\lib\xml\etree\ElementTree.py", line 1090, in _escape_attrib
return text.encode(encoding, "xmlcharrefreplace")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: ordinal not in range(128)
The workaround of changing Python's default encoding is considered evil and not always an option.
It could be possible to internally only use unicode and check and convert all input.
The text was updated successfully, but these errors were encountered:
The module is not able to handle input with non-ASCII characters. If unicode is passed, the str() conversion on most of the parameters throws UnicodeEncodeErrors as the Python default encoding of ASCII is not able to handle the non-ASCII characters.
If UTF-8 encoded strings are passed, etree's element.tostring() method is expecting unicode and tries to encode it:
The workaround of changing Python's default encoding is considered evil and not always an option.
It could be possible to internally only use unicode and check and convert all input.
The text was updated successfully, but these errors were encountered: