[ALUG] Why does Firefox always use UTF-8 for this page?

Greg Thomas Greg at TheThomasHome.co.uk
Wed Oct 10 11:47:16 BST 2007


On 10/10/2007, Chris G <cl at isbd.net> wrote:
> On Wed, Oct 10, 2007 at 09:11:37AM +0100, Greg Thomas wrote:
> >
> > What you showed originally was the HTML setting the charset, with the line
> >
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> >
> > This is embedded in the HTML, and overwritten by any content-type
> > presented in the HTTP headers, which is completely different.
> >
> > What is the CGI script written in? It probably has a line something like
> >
> > print "Content-Type: text/html\n";
> >
> > change that to
> >
> > print "Content-Type: text/html; charset=iso-8859-1\n";
> >
> There's a line in the config file:-
>
>     py["locale"] = "en_US.iso-8859-1"
>
> ... and there's also:-
>
>     py["blog_encoding"] = "iso-8859-1"
>
> ... but the output from the browser is still obstinately defaulted to
> UTF-8.

Is there a way you can examine the headers that the CGI script is
presenting without Apache getting in the way - with Perl you could
just run the script from the command line, and it would send the
output to stdout. Check and see if there is a content-type header
specifying the right charset. I suspect not. Googling turns up
http://www.python.org/doc/current/lib/cgi-intro.html which suggests
that the header is output explicitly ('print "Content-Type:
text/html"').




More information about the main mailing list