Changeset 648

Show
Ignore:
Timestamp:
04/25/06 17:45:46
Author:
miyagawa
Message:

sort of nasty hack to force Unicode flag in Atom feeds. Fixes #194

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm

    r638 r648  
    9191 
    9292    my $feed = Plagger::Feed->new; 
    93     $feed->title($remote->title); 
     93    $feed->title(_u($remote->title)); 
    9494    $feed->url($url); 
    9595    $feed->link($remote->link); 
    96     $feed->description($remote->tagline); # xxx should support Atom 1.0 
     96    $feed->description(_u($remote->tagline)); # xxx should support Atom 1.0 
    9797    $feed->language($remote->language); 
    98     $feed->author($remote->author); 
     98    $feed->author(_u($remote->author)); 
    9999    $feed->updated($remote->modified); 
    100100    $feed->source_xml($$xml_ref); 
     
    114114    for my $e ($remote->entries) { 
    115115        my $entry = Plagger::Entry->new; 
    116         $entry->title($e->title); 
    117         $entry->author($e->author); 
     116        $entry->title(_u($e->title)); 
     117        $entry->author(_u($e->author)); 
    118118 
    119119        my $category = $e->category; 
    120120           $category = [ $category ] if $category && !ref($category); 
    121         $entry->tags($category) if $category; 
     121        $entry->tags([ map _u($_), @$category ]) if $category; 
    122122 
    123123        $entry->date( Plagger::Date->rebless($e->issued) ) 
     
    135135        $entry->feed_link($feed->link); 
    136136        $entry->id($e->id); 
    137         $entry->body($e->content->body || $e->summary->body); 
     137        $entry->body(_u($e->content->body || $e->summary->body)); 
    138138 
    139139        my $args = { 
     
    150150    $context->log(info => "Aggregate $url success: " . $feed->count . " entries."); 
    151151    $context->update->add($feed); 
     152} 
     153 
     154sub _u { 
     155    my $str = shift; 
     156    Encode::_utf8_on($str); 
     157    $str; 
    152158} 
    153159