From b810cbc0d06df0a04e3380166215b8ad2f40524c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 25 Oct 2015 17:40:09 -0400 Subject: Properly handle filenames with non-ASCII characters. #432 --- coverage/xmlreport.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'coverage/xmlreport.py') diff --git a/coverage/xmlreport.py b/coverage/xmlreport.py index b8f8a9e4..d7c2f44a 100644 --- a/coverage/xmlreport.py +++ b/coverage/xmlreport.py @@ -8,6 +8,7 @@ import sys import time import xml.dom.minidom +from coverage import env from coverage import __url__, __version__, files from coverage.misc import isolate_module from coverage.report import Reporter @@ -116,7 +117,10 @@ class XmlReporter(Reporter): xcoverage.setAttribute("branch-rate", branch_rate) # Use the DOM to write the output file. - outfile.write(self.xml_out.toprettyxml()) + out = self.xml_out.toprettyxml() + if env.PY2: + out = out.encode("utf8") + outfile.write(out) # Return the total percentage. denom = lnum_tot + bnum_tot -- cgit v1.2.1