3 BEGIN { require "./test.pl"; }
14 my ($enc, $content, $do_bom) = @_;
15 my $template = $templates{$enc};
16 die "Unsupported encoding $enc" unless $template;
17 return pack "$template*", ($do_bom ? 0xFEFF : ()), unpack "C*", $content;
21 my ($enc, $tag, $bom) = @_;
22 open my $fh, ">", "utf$$.pl" or die "utf.pl: $!";
24 print $fh bytes_to_utf($enc, "$tag\n", $bom);
26 my $got = do "./utf$$.pl";
31 for my $enc (qw(utf16le utf16be utf8)) {
32 for my $value (123, 1234, 12345) {
33 test($enc, $value, $bom);
39 1 while unlink "utf$$.pl";