Skip to content

Commit 74cd3bd

Browse files
committed
fix: use text_type to control unicode output
1 parent 526571d commit 74cd3bd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nipype/utils/provenance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from ordereddict import OrderedDict
1818

1919
import prov.model as pm
20-
from ..external.six import string_types
20+
from ..external.six import string_types, text_type
2121

2222
from .. import get_info
2323
from .filemanip import (md5, hashlib, hash_infile)
@@ -140,7 +140,7 @@ def safe_encode(x, as_literal=True):
140140
value = x
141141
if not as_literal:
142142
return value
143-
return pm.Literal(value, pm.XSD['string'])
143+
return pm.Literal(text_type(value, 'utf-8'), pm.XSD['string'])
144144
if isinstance(x, int):
145145
if not as_literal:
146146
return x
@@ -183,7 +183,7 @@ def safe_encode(x, as_literal=True):
183183
return pm.Literal(dumps(x), nipype_ns['pickle'])
184184
except TypeError as e:
185185
iflogger.info(e)
186-
value = "Could not encode: " + str(e)
186+
value = "Could not encode: " + text_type(e, 'utf-8')
187187
if not as_literal:
188188
return value
189189
return pm.Literal(value, pm.XSD['string'])

0 commit comments

Comments
 (0)