diff options
author | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-06-10 18:40:22 +0000 |
---|---|---|
committer | Nick Ing-Simmons <nik@tiuk.ti.com> | 2002-06-10 18:40:22 +0000 |
commit | 6874a2de0b9fdd8dc928c94c0f22e6f2b45cb330 (patch) | |
tree | 26fe9d936dc27d8c9fdd53ea782f2331cd994577 /t | |
parent | b671651657cc99e2670814b9a73fda32b6ed458d (diff) | |
download | perl-6874a2de0b9fdd8dc928c94c0f22e6f2b45cb330.tar.gz |
binmode(FH); to act like binmode(FH,":bytes") as well as
turning off CRLF features.
p4raw-id: //depot/perlio@17171
Diffstat (limited to 't')
-rwxr-xr-x | t/io/utf8.t | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/t/io/utf8.t b/t/io/utf8.t index af356fc88f..e1ecf1c433 100755 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -66,17 +66,17 @@ close(F); { $a = chr(300); # This *is* UTF-encoded $b = chr(130); # This is not. - + open F, ">:utf8", 'a' or die $!; print F $a,"\n"; close F; - + open F, "<:utf8", 'a' or die $!; $x = <F>; chomp($x); print "not " unless $x eq chr(300); print "ok 14\n"; - + open F, "a" or die $!; # Not UTF binmode(F, ":bytes"); $x = <F>; @@ -86,9 +86,10 @@ close(F); print "not " unless $x eq $chr; print "ok 15\n"; close F; - + open F, ">:utf8", 'a' or die $!; binmode(F); # we write a "\n" and then tell() - avoid CRLF issues. + binmode(F,":utf8"); # turn UTF-8-ness back on print F $a; my $y; { my $x = tell(F); @@ -96,30 +97,30 @@ close(F); print "not " unless $x == $y; print "ok 16\n"; } - + { # Check byte length of $b use bytes; my $y = length($b); print "not " unless $y == 1; print "ok 17\n"; } - + print F $b,"\n"; # Don't upgrades $b - + { # Check byte length of $b use bytes; my $y = length($b); print "not ($y) " unless $y == 1; print "ok 18\n"; } - + { my $x = tell(F); { use bytes; if (ord('A')==193){$y += 2;}else{$y += 3;}} # EBCDIC ASCII print "not ($x,$y) " unless $x == $y; print "ok 19\n"; } - + close F; - + open F, "a" or die $!; # Not UTF binmode(F, ":bytes"); $x = <F>; @@ -128,14 +129,14 @@ close(F); if (ord('A') == 193) { $chr = v141.83.130; } # EBCDIC printf "not (%vd) ", $x unless $x eq $chr; print "ok 20\n"; - + open F, "<:utf8", "a" or die $!; $x = <F>; chomp($x); close F; printf "not (%vd) ", $x unless $x eq chr(300).chr(130); print "ok 21\n"; - + open F, ">", "a" or die $!; if (${^OPEN} =~ /:utf8/) { binmode(F, ":bytes:"); @@ -158,7 +159,7 @@ print F $a; binmode(F, ":bytes"); print F chr(130)."\n"; close F; - + open F, "<", "a" or die $!; binmode(F, ":bytes"); $x = <F>; chomp $x; |