#!perl -w use strict; use Test::More tests => 2; use HTML::Parser; SKIP: { skip "This perl does not support Unicode", 2 if $] < 5.008; my @parsed; my $p = HTML::Parser->new( api_version => 3, start_h => [\@parsed, 'tag, attr'], ); my @warn; $SIG{__WARN__} = sub { push(@warn, $_[0]); }; $p->parse("\xEF\xBB\xBFHi there"); $p->eof; #use Encode; $p->parse("\xEF\xBB\xBFHi there" . chr(0x263A)); $p->eof; $p->parse("\xFF\xFEHi there"); $p->eof; $p->parse("\xFE\xFFHi there"); $p->eof; $p->parse("\0\0\xFF\xFEHi there"); $p->eof; $p->parse("\xFE\xFF\0\0Hi there"); $p->eof; for (@warn) { s/line (\d+)/line ##/g; } is(join("", @warn), <new( api_version => 3, start_h => [\@parsed, 'tag'], ); $p->parse("\xEF\xBB\xBFHi there"); $p->eof; ok(!@warn); }