Re: How to apply apache directives to pyblosxom bog files?

Chris G <[email protected]>
Newsgroups gmane.comp.web.pyblosxom.user
Message-ID <20071010081928.GG68453@newred>
On Tue, Oct 09, 2007 at 09:48:30PM -0400, Blake Winton wrote:
> will wrote:
> >>>> I suspect that the answer will depend on your setup.
> >>> Even so how do I apply an AddCharset directive?  What suffix do I use?
> >>> .py possibly?
> >> I've gone the PyBlosxom route, and added a file named 
> >> "content_type.html" in my html flavour, containing the line:
> >> application/xml;charset=utf-8
> >> and it all seems to work for me...
>  > Oh, that's kind of wild.  That's something we should add to the
>  > documentation...  but I have no idea where a good place for that would
>  > be.
> 
> In the Flavor section, with a cross-link somewhere?  In the index?  In 
> the mailing list archives?  ;)  Seriously, yeah, we should add that to 
> the docs.  Chris, where did you look first to try and figure it out?
> 
The whole problem is that *absolutely regardless* of what the HTML
says (whether static or, as in pyblosxom, dynamically generated) the
browser overrides it.

My HTML from pyblosxom has:-

    <head>
       <title>Chris Info</title>
       <link rel="stylesheet" href="http://home.isbd.net/css/infowiki.css" type="text/css">
       <link rel="alternate" type="application/xml" title="RSS" href="/blog/rss2.xml">
       <link rel="top" href="/" title="pyblosxom.sourceforge.net">
       <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>

in all the headers but when served by the apache server in Fedora 7 it
defaults to UTF-8.  I.e. if I issue the command "curl -I
http://home.isbd.net/cgi-bin/pyblosxom.cgi" the result is:-

    HTTP/1.1 200 OK
    Date: Wed, 10 Oct 2007 08:12:14 GMT
    Server: Apache/2.2.6 (Fedora)
    Content-Length: 2990
    Connection: close
    Content-Type: text/html; charset=UTF-8

The setting in the HTML header is *always* overridden by the server
setting set by:-

    AddDefaultCharset UTF-8

in the httpd.conf file.


I've finally got what I want by adding (to /etc/httpd/conf/httpd.conf):-

    <Directory /var/www/cgi-bin>
        AddDefaultCharset ISO-8859-1
    </Directory>

This of course sets all CGI generated HTML to be ISO-8859-1 which is
OK for the moment.  If I want to be more specific about pyblosxom CGI
then I could probably use a <Location> directive.

Whatever, faffing about with the generated headers in the HTML has no
effect at all when apache is installed with what appears to be the
default httpd.conf file nowadays.

-- 
Chris Green

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.