Trying to set a cookie within a python script

MRAB python at mrabarnett.plus.com
Tue Aug 3 22:49:22 EDT 2010


Νίκος wrote:
>> On 3 Αύγ, 21:00, Dave Angel <da... at ieee.org> wrote:
> 
>> A string is an object containing characters. A string literal is one of
>> the ways you create such an object. When you create it that way, you
>> need to make sure the compiler knows the correct encoding, by using the
>> encoding: line at beginning of file.
> 
[snip]
> Tell me something. What encoding should i pick for my scripts knowing
> that only contain english + greek chars??
> iso-8859-7 or utf-8 and why?
> 
This is easy to answer: UTF-8 with the:

     # -*- coding: UTF-8 -*-

comment to tell Python that your script file is encoded in UTF-8.

I was once given a file in a language I don't know (translations for
display messages). Some of the text didn't look quite right. It took me
a while to figure out that it was written on a machine which used CP1250
and my machine used CP1252. If everybody used the same encoding then
such problems wouldn't occur, and UTF-8 can handle any characters which
are in Unicode: Latin, Greek, Cyrillic, Arabic, etc.



More information about the Python-list mailing list