Changeset 1633

Show
Ignore:
Timestamp:
08/26/05 16:36:12
Author:
miyagawa
Message:

workaround encode_xml without HTML::Entities

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • WebService-Bloglines/trunk/Changes

    r1630 r1633  
    11Revision history for Perl extension WebService::Bloglines 
     2 
     30.09  Fri Aug 26 07:34:53 UTC 2005 
     4        - Fix bug in 0.08: HTML::Entities::encode() is not good for utf-8 bytes 
    25 
    360.08  Thu Aug 25 19:53:16 UTC 2005 
  • WebService-Bloglines/trunk/lib/WebService/Bloglines.pm

    r1630 r1633  
    33use strict; 
    44use vars qw($VERSION); 
    5 $VERSION = 0.08
     5$VERSION = 0.09
    66 
    77use LWP::UserAgent; 
  • WebService-Bloglines/trunk/lib/WebService/Bloglines/Entries.pm

    r1630 r1633  
    22 
    33use vars qw($VERSION); 
    4 $VERSION = 0.08
     4$VERSION = 0.09
    55 
    66use strict; 
    77use XML::RSS::LibXML; 
    88use XML::LibXML; 
    9 use HTML::Entities; 
    109 
    1110sub parse { 
     
    1312 
    1413    # temporary workaround till Bloglines fixes this bug 
    15     $xml =~ s!<webMaster>(.*?)</webMaster>!HTML::Entities::encode($1)!eg; 
     14    $xml =~ s!<webMaster>(.*?)</webMaster>!encode_xml($1)!eg; 
    1615 
    1716    my $parser = XML::LibXML->new; 
     
    2928    } 
    3029    return wantarray ? @entries : $entries[0]; 
     30} 
     31 
     32my %Map = ('&' => '&amp;', '"' => '&quot;', 
     33           '<' => '&lt;', '>' => '&gt;', 
     34           '\'' => '&apos;'); 
     35my $RE  = join '|', keys %Map; 
     36 
     37sub encode_xml { 
     38    my $str = shift; 
     39    $str =~ s!($RE)!$Map{$1}!g; 
     40    $str; 
    3141} 
    3242