[Tutor] testing u=unicode(str, 'utf-8') and u = str.decode('utf-8')

Keo Sophon keosophon at khmeros.info
Thu Apr 6 05:22:07 CEST 2006


Hi,

Today i tested u=unicode(str,'utf-8') and u=str.decode('utf-8'). Then in both 
case I used:

if isinstance(u,str):
   print "just string"
else:
  print "unicode"

the result of both case are "unicode". So it seems u=unicode(str,'utf-8') and 
u=str.decode('utf-8') are the same. How about the processing inside? is it 
same?

Phon


More information about the Tutor mailing list