use str on objects which are not strings

This commit is contained in:
Alan Hamlett 2017-01-10 10:05:24 -08:00
parent f4b40089f3
commit a69c50f470
1 changed files with 4 additions and 1 deletions

View File

@ -56,7 +56,10 @@ if is_py2:
try:
return unicode(text)
except:
return text.decode('utf-8', 'replace')
try:
return text.decode('utf-8', 'replace')
except AttributeError:
return unicode(str(text))
elif is_py3:
def u(text):