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:
|
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):
|
||||||
|
|
Loading…
Reference in a new issue