[Tutor] Encoding
Giorgio
anothernetfellow at gmail.com
Wed Mar 3 18:28:10 CET 2010
Ops, i have another update:
string = u"blabla"
This is unicode, ok. Unicode UTF-8?
Thankyou
2010/3/3 Giorgio <anothernetfellow at gmail.com>
> 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
>
--
--
AnotherNetFellow
Email: anothernetfellow at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100303/02667fdc/attachment.html>
More information about the Tutor
mailing list