Skip to content

Commit 5202367

Browse files
committed
fix encoding= argument for ElementTree.write
1 parent d50ad1f commit 5202367

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bioformats/omexml.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
import sys
1818
if sys.version_info.major == 3:
1919
from io import StringIO
20+
uenc = 'unicode'
2021
else:
2122
from cStringIO import StringIO
23+
uenc = 'utf-8'
2224

2325
import datetime
2426
import logging
@@ -333,11 +335,11 @@ def __str__(self):
333335
ElementTree.register_namespace("om", NS_ORIGINAL_METADATA)
334336
result = StringIO()
335337
ElementTree.ElementTree(self.root_node).write(result,
336-
encoding = "utf-8",
337-
method = "xml")
338+
encoding=uenc,
339+
method="xml")
338340
return result.getvalue()
339341

340-
def to_xml(self, indent="\t", newline="\n", encoding = "utf-8"):
342+
def to_xml(self, indent="\t", newline="\n", encoding=uenc):
341343
return str(self)
342344

343345
def get_ns(self, key):

0 commit comments

Comments
 (0)