I used this :
u = unicode(text, 'utf-8')
But getting error with Python 3 (or... maybe I just forgot to include something) :
NameError: global name 'unicode' is not defined
Literal strings are unicode by default in Python3.
text is a
bytes object, just use
unicode of Python2 is equivalent to
str in Python3, so you can also write:
if you prefer.
As a workaround, I've been using this:
# Fix Python 2.x. try: UNICODE_EXISTS = bool(type(unicode)) except NameError: unicode = lambda s: str(s)