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

View file

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