Use to_utf8() instead of safe_encode() in convert_str()
safe_encode() convert string using locale [1]. To avoid possible confuses we should use to_utf8() method instead. [1] https://wiki.openstack.org/wiki/Python3#safe_encode Change-Id: I4b8d81bcec389f224084e5270e884e38836d1136
This commit is contained in:
parent
74c8f65342
commit
6bc48aeed6
@ -831,7 +831,7 @@ def convert_str(text):
|
||||
* convert to Unicode on Python 3: decode bytes from UTF-8
|
||||
"""
|
||||
if six.PY2:
|
||||
return encodeutils.safe_encode(text)
|
||||
return encodeutils.to_utf8(text)
|
||||
else:
|
||||
if isinstance(text, bytes):
|
||||
return text.decode('utf-8')
|
||||
|
Loading…
Reference in New Issue
Block a user