Fix unicode conversion utility.

This commit is contained in:
Lance Stout 2012-08-10 12:41:29 -07:00
parent d11a67702e
commit 230465b946

View file

@ -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)