fix util.to_unicode for py2/py3.

This commit is contained in:
tedder committed 2018-09-22 15:54:29 -07:00
1 parent c2f09b1715
commit 52fe19e5f9
1 file changed
+1 -1
+1 -1
View File
@@ -510,7 +510,7 @@ def to_str(s_or_u, encoding="utf-8", errors="strict"):
def to_unicode(s_or_u, encoding="utf-8", errors="strict"):
"""Make sure ``s_or_u`` is a unicode string."""
if isinstance(s_or_u, str):
if isinstance(s_or_u, bytes):
return s_or_u.decode(encoding, errors=errors)
else:
return s_or_u