[Zope] Charset HTTP header switched to UTF-8. Bug or feature ?
Gilles Lenfant
gilles at pilotsystems.net
Thu Aug 28 14:08:49 EDT 2003
----- Original Message -----
From: "Chris Withers" <chrisw at nipltd.com>
To: "Gilles Lenfant" <gilles at pilotsystems.net>
Cc: <zope at zope.org>
Sent: Thursday, August 28, 2003 12:08 PM
Subject: Re: [Zope] Charset HTTP header switched to UTF-8. Bug or feature ?
> Gilles Lenfant wrote:
> > The "sometemplate" is published with this HTTP header :
> >
> > Content-Type: text/html;charset=UTF-8
> >
> > When nowhere in my scripts/templates, I stated to use that charset.
> > You can imagine the ugly things that are displayed :-/
>
> Toby Dickenson would be the man to ask, IIRC.
> Have you set UTF-8 as a default anywhere on your system?
>
> > I found a workaround: forcing the HTTP header of the response...
> >
> > <sample>
> > REQUEST.RESPONSE.setHeader('Content-Type', 'text/html;
charset=iso-8859-1')
> >
> > return context.sometemplate(param1=value1, ...)
> > </sample>
>
> What about putting a meta declaration in the <head>? At least you don't
have the
> clunky python code then...
>
> cheers,
>
> Chris
>
Thanks Chris,
I tried this before patching the Python script that handles the form.
Putting the charset=iso-8859-1 declaration in the <head> didn't help.
The charset declaration of the HTTP header (Content-Type) has priority over
the HTML charset declaration (as observed with IE and Mozilla = 99% of
users).
That's the reason why I ask if this is a bug or a feature.
I can't understand this because with the python engine that runs Zope...
>>> import sys
>>> sys.getdefaultencoding()
iso-8859-1
And my system locales are set to that charset too.
If it's a feature, is there some place where we can stand what charset
should be used for publishing objects behind such or such folder.
After further tests, I noticed this on DTML as well as ZPT templates.
Cheers
--Gilles
More information about the Zope
mailing list