diff --git a/odml/tools/xmlparser.py b/odml/tools/xmlparser.py index 3651c2b1..5c9791b0 100644 --- a/odml/tools/xmlparser.py +++ b/odml/tools/xmlparser.py @@ -199,7 +199,7 @@ def write_file(self, filename, local_style=False, custom_template=None): # calculate the data before opening the file in case we get any exception data = str(self) - with open(filename, "w") as file: + with open(filename, "w", encoding = "utf-8") as file: file.write("%s\n" % XML_HEADER) if not local_style and not custom_template: file.write("%s\n" % EXTERNAL_STYLE_HEADER) diff --git a/test/test_xml_writer.py b/test/test_xml_writer.py index 579ae141..955ca38a 100644 --- a/test/test_xml_writer.py +++ b/test/test_xml_writer.py @@ -20,7 +20,7 @@ def setUp(self): doc = odml.Document() sec = doc.create_section(name="sec", type="test") - _ = sec.create_property(name="prop", value=['a', 'b', 'c']) + _ = sec.create_property(name="prop", value=['a', 'b', 'c', 'μ']) self.doc = doc self.writer = XMLWriter(doc)