En Sat, 23 Jun 2007 01:10:19 -0300, Genie T <[EMAIL PROTECTED]>  
escribió:

> can anybody tell me whether these two expressions have the same
> meanings?
>
> s = u'<unicode string here>'
> s1 = s.encode('utf-8')
>
> AND
>
> s1 = unicode(s,'utf-8')

No - but consider this (assuming your terminal uses utf-8):

py> u1 = u'<some text here>'
py> s1 = u1.encode('utf-8')
py>
py> s2 = '<some text here>'
py> u2 = s2.decode('utf-8')
py>
py> type(u1), type(u2)
(<type 'unicode'>, <type 'unicode'>)
py> u1==u2
True
py> type(s1), type(s2)
(<type 'str'>, <type 'str'>)
py> s1==s2
True

-- 
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to