Changeset 2013

Show
Ignore:
Timestamp:
10/08/06 12:30:54
Author:
miyagawa
Message:

we sohuldn't look at META tag when it's application/xhtml+xml, per http://www.w3.org/TR/xhtml-media-types/xhtml-media-types.html#application-xhtml-xml

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • HTTP-Response-Charset/trunk/lib/HTTP/Response/Charset.pm

    r2012 r2013  
    4646    # 2) If it looks like HTML, look for META head tags 
    4747    # if there's already META tag scanned, @ct == 2 
    48     if (@ct < 2 && mime_is_html($ct[0]->[0])) { 
     48    if (@ct < 2 && $ct[0]->[0] eq 'text/html') { 
    4949        require HTML::HeadParser; 
    5050        my $parser = HTML::HeadParser->new; 
     
    9797} 
    9898 
    99 sub mime_is_html { 
    100     my $ct = shift; 
    101     return $ct =~ m!^text/html$!i || $ct =~ m!^application/xhtml\+xml$!i; 
    102 } 
    103  
    104991; 
    105100__END__ 
     
    150145 
    151146If there's no charset= attribute in Content-Type, and if Conetnt-Type 
    152 looks like HTML (i.e. I<text/html> or I<application/xhtml+xml>), this 
    153 module will scan HTML head tags for: 
     147looks like HTML (i.e. I<text/html>), this module will scan HTML head 
     148tags for: 
    154149 
    155150  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
     
    205200=head1 SEE ALSO 
    206201 
    207 L<HTTP::Response>, L<HTML::HeadParser>, L<LWP::UserAgent>, L<Encode::Detect> 
     202L<HTTP::Response>, L<HTML::HeadParser>, L<LWP::UserAgent>, L<Encode::Detect>, L<http://use.perl.org/~miyagawa/journal/31250> 
    208203 
    209204=cut