HTML-HiLiter
view release on metacpan or search on metacpan
lib/HTML/HiLiter.pm view on Meta::CPAN
my ( $self, $tag, $attr, $text ) = @_;
# if this is a meta tag, check for encoding. we want to make sure
# we do not declare anything other than utf-8 or ascii in the output,
# since Search::Tools::HiLiter always returns utf-8.
if ( lc($tag) eq 'meta' ) {
if ( exists $attr->{'http-equiv'} or exists $attr->{'HTTP-EQUIV'} ) {
if ( exists $attr->{content} or exists $attr->{CONTENT} ) {
my $name = $attr->{'http-equiv'} || $attr->{'HTTP-EQUIV'};
my $content = $attr->{content} || $attr->{CONTENT};
if ( lc($name) eq 'content-type'
&& lc($content) !~ m/ascii|utf-8/i )
{
$$text
= qq(<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>);
}
}
}
}
}
( run in 3.340 seconds using v1.01-cache-2.11-cpan-524268b4103 )