[Tutor] Encoding

Stefan Behnel stefan_ml at behnel.de
Mon Mar 8 07:50:06 CET 2010


Giorgio, 05.03.2010 14:56:
> What i don't understand is why:
>
> s = u"ciao è ciao" is converting a string to unicode, decoding it from the
> specified encoding but
>
> t = "ciao è ciao"
> t = unicode(t)
>
> That should do exactly the same instead of using the specified encoding
> always assume that if i'm not telling the function what the encoding is, i'm
> using ASCII.
>
> Is this a bug?

Did you read the Unicode tutorial at the link I posted? Here's the link again:

http://www.amk.ca/python/howto/unicode

Stefan



More information about the Tutor mailing list