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:
Ivan Kolodyazhny 2016-05-06 14:50:32 +03:00
parent 74c8f65342
commit 6bc48aeed6

View File

@ -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')