[Tutor] Encoding

Giorgio anothernetfellow at gmail.com
Wed Mar 3 17:10:05 CET 2010


Ok.

So, how do you encode .py files? UTF-8?

2010/3/3 Dave Angel <davea at ieee.org>

> Giorgio wrote:
>
>>
>>>
>>>>  Depends on your python version. If you use python 2.x, you have to use
>>>> a
>>>>
>>>>
>>> u before the string:
>>>
>>> s = u'Hallo World'
>>>
>>>
>>
>>
>> Ok. So, let's go back to my first question:
>>
>> s = u'Hallo World' is unicode in python 2.x -> ok
>> s = 'Hallo World' how is encoded?
>>
>>
>>
> Since it's a quote literal in your source code, it's encoded by your text
> editor when it saves the file, and you tell Python which encoding it was by
> the second line of your source file, right after the shebang line.
>
> A sequence of bytes in an html file should be should have its encoding
> identified by the tag at the top of the html file.  And I'd  *guess* that on
> a form result, the encoding can be assumed to match that of the html of the
> form itself.
>
> DaveA
>
>


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


More information about the Tutor mailing list