[Tutor] Encoding

Giorgio anothernetfellow at gmail.com
Thu Mar 4 20:23:06 CET 2010


2010/3/4 spir <denis.spir at gmail.com>

>
>
> How do you know your win XP terminal is configured to deal with text using
> utf8? Why do you think it should?
>

I think there is an option in IDLE configuration to set this. So, if my
entire system is not utf8 i can't use the IDLE for this test?


>
> This trial uses the default format of your system. It does the same as
>   a = "giorgio è giorgio".encode(default_format)
> It's a shorcut for ustring *literals* (constants), directly expressed by
> the programmer. In source code, it would use the format specified on top of
> the file.
>



> This trial uses ascii because you give no format (yes, it can be seen as a
> flaw). It does the same as
>   a = "giorgio è giorgio".encode("ascii")
>

Ok,so you confirm that:

s = u"ciao è ciao" will use the file specified encoding, and that

t = "ciao è ciao"
t = unicode(t)

Will use, if not specified in the function, ASCII. It will ignore the
encoding I specified on the top of the file. right?

Again, thankyou. I'm loving python and his community.

Giorgio




-- 
--
AnotherNetFellow
Email: anothernetfellow at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100304/6f71d83e/attachment.html>


More information about the Tutor mailing list