diff --git a/README.rst b/README.rst index 470cef1..b585af1 100644 --- a/README.rst +++ b/README.rst @@ -89,3 +89,10 @@ Running the tests pip install tox tox +Releasing a new version +----------------------- + +1. Bump version in `setup.py` +2. Build distribution with `python setup.py sdist bdist_wheel` +3. Upload to Pypi with `twine upload dist/*` +4. Verify the new version was uploaded at https://pypi.org/project/junit-xml/#history diff --git a/junit_xml/__init__.py b/junit_xml/__init__.py index 0cfef29..0dd4426 100644 --- a/junit_xml/__init__.py +++ b/junit_xml/__init__.py @@ -318,8 +318,9 @@ def to_xml_report_file(file_descriptor, test_suites, prettyprint=True, encoding= Writes the JUnit XML document to a file. """ xml_string = to_xml_report_string(test_suites, prettyprint=prettyprint, encoding=encoding) - # has problems with encoded str with non-ASCII (non-default-encoding) characters! - file_descriptor.write(xml_string) + # this fixes the problem with encoded str with non-ASCII (non-default-encoding) characters! + string_for_output = xml_string.encode('utf8', 'replace') + file_descriptor.write(string_for_output) def _clean_illegal_xml_chars(string_to_clean):