HTML-Encapsulate
view release on metacpan or search on metacpan
lib/HTML/Encapsulate.pm view on Meta::CPAN
$head_parser->parse($chunk);
$head_parser->eof;
my $content_type = $head_parser->header('Content-Type');
return unless $content_type;
my ($words) = HTTP::Headers::Util::split_header_words($content_type);
my %param = @$words;
return $param{charset};
}
# 3) If there's a UTF BOM set, look for it
my $count = 0;
while (my ($enc, $bom) = $boms->[$count++, $count++])
{
return $enc
if $bom eq substr($chunk, 0, length $bom);
}
# 4) If it looks like an XML document, look for XML declaration
if ($chunk =~ m!^<\?xml\s+version="1.0"\s+encoding="([\w\-]+)"\?>!) {
return $1;
( run in 0.318 second using v1.01-cache-2.11-cpan-e9daa2b36ef )