Switching from Apche to LiteSpeed
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Apr 2 02:38:08 EDT 2013
On Mon, 01 Apr 2013 20:29:47 +0000, John Gordon wrote:
> In <9a35850a-7fcb-4585-84ae-5e13cef9173a at googlegroups.com>
> =?ISO-8859-7?B?zd/q7/Igw+rxMzPq?= <nikos.gr33k at gmail.com> writes:
>
>> Just today i changed from HostGator to EZPZ, which means from Apache
>> Web Server to LiteSpeed.
>
>> Does anyone know why iam seeing what iam seeing at http://superhost.gr
>
>> I see weird encoding although inside my python script i have:
>
>> #!/usr/bin/python
>> # -*- coding=utf-8 -*
>
> I believe the syntax is to use a colon, not an equal sign. i.e.:
>
> # -*- coding: utf-8 -*-
>
> Your example is also missing the final dash after the asterisk.
I don't think that will make a difference. Encoding declaration lines are
*very* flexible, and will match either a colon or equals sign. So long as
it matches this regular expression, it will be understood:
coding[=:]\s*([-\w.]+)
http://docs.python.org/2/reference/lexical_analysis.html#encoding-declarations
However, it is important that the encoding being declared matches the
actual encoding being used! For example, if you take a Latin-1 file, and
declare that it is UTF-8, it won't magically turn the Latin-1 file into
UTF-8. Instead you'll get bytes being decoded wrongly.
--
Steven
More information about the Python-list
mailing list