newbie question about unicode

Carsten Haese carsten at
Sat Jun 23 07:04:12 CEST 2007

On Sat, 23 Jun 2007 04:10:19 -0000, Genie T wrote
> Hi,
> can anybody tell me whether these two expressions have the same
> meanings?
> s = u'<unicode string here>'
> s1 = s.encode('utf-8')
> s1 = unicode(s,'utf-8')

Considering that one works and the other doesn't, no, they don't have the same

The unicode() function decodes a given byte string into a unicode object, but
you're giving it a unicode object. What are you actually trying to achieve?

If you're just trying to get a handle on the topic, I recommend you read


Carsten Haese

More information about the Python-list mailing list