local $SIG{__WARN__} = sub { $@ = shift };
open F, ">a";
binmode F;
- print F "foo", chr(0xE4), "\n";
- print F "foo", chr(0xF6), "\n";
+ my ($chrE4, $chrF6) = (chr(0xE4), chr(0xF6));
+ if (ord('A') == 193) # EBCDIC
+ { ($chrE4, $chrF6) = (chr(0x43), chr(0xEC)); }
+ print F "foo", $chrE4, "\n";
+ print F "foo", $chrF6, "\n";
close F;
open F, "<:utf8", "a";
undef $@;
my $line = <F>;
- like( $@, qr/utf8 "\\xE4" does not map to Unicode .+ <F> line 1/,
+ my ($chrE4, $chrF6) = ("E4", "F6");
+ if (ord('A') == 193) { ($chrE4, $chrF6) = ("43", "EC"); } # EBCDIC
+ like( $@, qr/utf8 "\\x$chrE4" does not map to Unicode .+ <F> line 1/,
"<:utf8 readline must warn about bad utf8");
undef $@;
$line .= <F>;
- like( $@, qr/utf8 "\\xF6" does not map to Unicode .+ <F> line 2/,
+ like( $@, qr/utf8 "\\x$chrF6" does not map to Unicode .+ <F> line 2/,
"<:utf8 rcatline must warn about bad utf8");
close F;
}
print "not " if $x =~ /[\x{100}]/;
print "ok 604\n";
- print "not " unless $x =~ /\p{InLatin1Supplement}/;
+ # the next two tests must be ignored on EBCDIC
+ print "not " unless $x =~ /\p{InLatin1Supplement}/ or ord("A") == 193;
print "ok 605\n";
- print "not " if $x =~ /\P{InLatin1Supplement}/;
+ print "not " if $x =~ /\P{InLatin1Supplement}/ and ord("A") != 193;
print "ok 606\n";
print "not " if $x =~ /\p{InLatinExtendedA}/;
print "not " unless chr(0xfb4f) =~ /\p{IsHebrew}/; # outside InHebrew
print "ok 664\n";
-print "not " unless chr(0xb5) =~ /\p{IsGreek}/; # singleton (not in a range)
+# singleton (not in a range, this test must be ignored on EBCDIC)
+print "not " unless chr(0xb5) =~ /\p{IsGreek}/ or ord("A") == 193;
print "ok 665\n";
print "not " unless chr(0x37a) =~ /\p{IsGreek}/; # singleton