2010/8/2 Νίκος <nikos.the.gr...@gmail.com>:
>>On 2 Αύγ, 23:57, Thomas Jollans <tho...@jollans.com> wrote:
>
>> So: tripple-check that
>>
>>  * your file is <insert encoding here (aka UTF-8)>
>>  * Python knows that
>>  * the web browser knows that
>
> Thank you! i used print ''' Content-Type: text/html; charset=UTF-8 /
> n''' and it worked.
> I'am still pretty confused about the encodings.
>
> Please tell me the difference between 3 things.
>
> a) Asking Notepad++(my editor) to save all my python scripts as UTF-8
> without BOM.

That affects what encoding the text file comprising the source code
itself is in.

> b) Using this line '# -*- coding: utf-8 -*-' Isn't this line supposed
> to tell browser that the contents of this python script as in UTF-8
> and to handle it as such?

This tells Python what encoding the text file comprising the source
code itself is in.

> c) print ''' Content-Type: text/html; charset=UTF-8 /n'''

This tells the web browser what encoding the HTML you're sending it is
in. Said HTML is output by your Python script and must match the
encoding you specify in (c).

Unless you have Unicode string literals in the source code itself, (a)
and (b) don't matter much. (c) is quite crucial.

Cheers,
Chris
--
http://blog.rebertia.com
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to