Yaroslav Kuzmin <[email protected]> wrote:
: ../t/io/bom.t........................... ...................................................... FAILED at test 2
Ah, gotcha: the construction of the test script is ascii-centric.
Karl, could you try adding the change below to the branch please?
This does leave me feeling the original test #1 is suspect.
Hugo
diff --git a/t/io/bom.t b/t/io/bom.t
index 70caf53..3a5ebe3 100644
--- a/t/io/bom.t
+++ b/t/io/bom.t
@@ -13,13 +13,21 @@ plan(tests => 3);
# that can be expanded to \r\n on DOSish systems.
fresh_perl_is("\xEF\xBB\xBFprint 1;\nprint 2", "12", {}, "script starts with a BOM" );
-# Big- and little-endian UTF-16
+# We need latin-1 codepoints here, even on an EBCDIC platform
+my @prog_codepoints = map [ ($_ >> 8), ($_ & 0xff) ], (
+ # BOM
+ 0xfeff,
+ # p r i n t sp 1 ; nl
+ 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x31, 0x3b, 0x0a,
+ # p r i n t sp 2 ;
+ 0x70, 0x72, 0x69, 0x6e, 0x74, 0x20, 0x32, 0x3b,
+);
+
+# Test BOM for big- and little-endian UTF-16
for my $end (0, 1) {
my $encoding = $end ? 'UTF-16LE' : 'UTF-16BE';
my $prog = join '', map chr($_), map {
$end ? @$_[0, 1] : @$_[1, 0]
- } (
- [ 0xFE, 0xFF ], map [ 0, ord($_) ], split //, "print 1;\nprint 2"
- );
+ } @prog_codepoints;
fresh_perl_is($prog, "12", {}, "BOM indicates $encoding");
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.