Fix unicode conversion utility.
This commit is contained in:
parent
d11a67702e
commit
230465b946
1 changed files with 2 additions and 0 deletions
|
@ -4,6 +4,8 @@ import hashlib
|
||||||
|
|
||||||
def unicode(text):
|
def unicode(text):
|
||||||
if sys.version_info < (3, 0):
|
if sys.version_info < (3, 0):
|
||||||
|
if isinstance(text, str):
|
||||||
|
text = text.decode('utf-8')
|
||||||
import __builtin__
|
import __builtin__
|
||||||
return __builtin__.unicode(text)
|
return __builtin__.unicode(text)
|
||||||
return str(text)
|
return str(text)
|
||||||
|
|
Loading…
Reference in a new issue