[Tutor] Encoding
Dave Angel
davea at ieee.org
Wed Mar 3 16:43:20 CET 2010
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
More information about the Tutor
mailing list