Diary of a geek

February 2006
Mon Tue Wed Thu Fri Sat Sun
   
7
         

My ugly mug

Where's Andrew?

Categories

Other people's blogs

Subscribe

RSS feed

Contact me

JavaScript required


Tuesday, 07 February 2006

Feed fixing finale

As I mentioned yesterday, I noted that Blosxom was misbehaving with RSS feeds where a flavour was used to customise the character set of the feed.

Tonight I made time to look under the hood, and found:

      if ($content_type =~ m{\Wxml$}) {
        # Escape <, >, and &, and to produce valid RSS
        my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');  
        my $escape_re  = join '|' => keys %escape;
        $title =~ s/($escape_re)/$escape{$1}/g;
        $body =~ s/($escape_re)/$escape{$1}/g;
      }

Which I promptly changed to

      if ($content_type =~ m{\Wxml(; charset=.*)?$}) {
        # Escape <, >, and &, and to produce valid RSS
        my %escape = ('<'=>'&lt;', '>'=>'&gt;', '&'=>'&amp;', '"'=>'&quot;');  
        my $escape_re  = join '|' => keys %escape;
        $title =~ s/($escape_re)/$escape{$1}/g;
        $body =~ s/($escape_re)/$escape{$1}/g;
      }

and now I can have my cake and eat it: UTF-8 encoded RSS feeds.

[23:13] [tech] [permalink]