
(or
echo "blosxom hold" sudo dpkg --set-selections)
A few people had pointed out to me that my blog was appearing weirdly in
Google Reader. I myself read my blog via Planet Debian and Planet Linux
Australia, where it appears fine, so I hadn't noticed the problem first
hand.
I did some digging tonight with the
Feed Validator, and I think I've
figured it out.
Funnily enough, it all started with a previous session with the Feed
Validator...
I wanted my blog to be UTF-8, with it being the new hotness and all.
Blosxom was spitting it out as ISO-8859-1.
I've just learned from this evening's debugging, that this is the behaviour
of
CGI.pm's
header() function if not provided with the
-charset
parameter.
I'd previously worked around this by defining my own content_type for the
RSS and HTML flavours. In this file, I just put
text/xml;
charset=utf-8and
text/html; charset=utf-8, respectively.
Unfortunately, this then breaks Blosxom's internal
HTML-escaping-for-RSS-feed code, which is conditional on the content type
being XML:
if ($content_type =~ m \Wxml$ )
# Escape <, >, and &, and to produce valid RSS
my %escape = ('<'=>'<', '>'=>'>', '&'=>'&', '"'=>'"');
my $escape_re = join ' ' => keys %escape;
$title =~ s/($escape_re)/$escape $1 /g;
$body =~ s/($escape_re)/$escape $1 /g;
This block of code was being ignored because the regex was anchored.
"
text/xml; charset=utf-8" didn't match "
\Wxml$". Whenever I
last had an attempt to make my blog's feed pass the Feed Validator, I must
have edited the Blosxom source code to make this regex not be anchored.
Then on November 11, 2008, I updated my Blosxom package to 2.0-14+etch1, to
address CVE-2008-2236 (incidentally, there doesn't appear to be a Debian
Security Advisory for this?), and my local modification got clobbered.
That'll teach me to make local modifications and not put the package on
hold. Blah.
It seems I'm screwed, there's no way to have a well-formed UTF-8 RSS feed
without requiring a source-code modification to Blosxom. I've either got to
change the way the
header() function is being called, or I've got
to change the regex to allow me to specify a charset in the flavour file,
and not disable HTML escaping.
Speaking of screwed, Blosxom seems incapable of making a well-formed RSS
0.91 feed anyway. It wants to put the <pubDate> tag inside an
<item>, which is a violation of
the DTD. There's supposed to
be one for the whole <channel>, not one per item (or "story" in
Blosxom-flavour-speak). You can't just move that from the story flavour file
to the head flavour file, because a pile of variables that you'd otherwise
use seem to only get set on a per-story basis. Double blah.
I'm starting to feel like Blosxom is outliving its usefulness, but I really
do not feel like embarking on a wholesale move to a new blogging platform,
I'm fairly entrenched.