use str on objects which are not strings
This commit is contained in:
parent
f4b40089f3
commit
a69c50f470
1 changed files with 4 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue