summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadu Greab <radu@netsoft.ro>2002-06-10 03:40:34 +0300
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-09 21:47:51 +0000
commit6e3dd797c11bfbcd0b6afff17d355b401f2f8429 (patch)
tree561d6707ba20458e3ca14049801819ef191f4729
parent72e53bfb76bf1a0270ca4c38940669d58edefe78 (diff)
downloadperl-6e3dd797c11bfbcd0b6afff17d355b401f2f8429.tar.gz
[ID 20020609.007] Not OK: perl v5.8.0 +DEVEL17060 on i686-linux 2.4.18-4smp (UNINSTALLED)
Message-Id: <200206092140.g59LeYn15745@ix.netsoft.ro> Fixes for en_US.UTF-8 failures, all but ext/PerlIO/t/fallback.t ones which I cannot figure out. p4raw-id: //depot/perl@17150
-rw-r--r--ext/Digest/MD5/t/files.t2
-rw-r--r--ext/Encode/t/CJKT.t7
-rw-r--r--ext/Encode/t/guess.t2
-rw-r--r--ext/Storable/t/malice.t2
4 files changed, 10 insertions, 3 deletions
diff --git a/ext/Digest/MD5/t/files.t b/ext/Digest/MD5/t/files.t
index 650121f517..34ef9e0dea 100644
--- a/ext/Digest/MD5/t/files.t
+++ b/ext/Digest/MD5/t/files.t
@@ -175,6 +175,7 @@ sub digest_file
#print "$file $method\n";
open(FILE, $file) or die "Can't open $file: $!";
+ eval { binmode(FILE, ":bytes") }; # Perl 5.8.0+ only
my $digest = Digest::MD5->new->addfile(*FILE)->$method();
close(FILE);
@@ -186,6 +187,7 @@ sub cat_file
my($file) = @_;
local $/; # slurp
open(FILE, $file) or die "Can't open $file: $!";
+ eval { binmode(FILE, ":bytes") }; # Perl 5.8.0+ only
my $tmp = <FILE>;
close(FILE);
$tmp;
diff --git a/ext/Encode/t/CJKT.t b/ext/Encode/t/CJKT.t
index 0c9bb7b65a..412d01e24d 100644
--- a/ext/Encode/t/CJKT.t
+++ b/ext/Encode/t/CJKT.t
@@ -44,7 +44,7 @@ my %Charset =
my $dir = dirname(__FILE__);
my $seq = 1;
-for my $charset (sort keys %Charset){
+for my $charset (sort keys %Charset) {
my ($src, $uni, $dst, $txt);
my $transcoder = find_encoding($Charset{$charset}[0]) or die;
@@ -70,7 +70,7 @@ for my $charset (sort keys %Charset){
if (PerlIO::Layer->find('perlio')){
binmode($dst, ":utf8");
print $dst $uni;
- }else{ # ugh!
+ } else { # ugh!
binmode($dst);
my $raw = $uni; Encode::_utf8_off($raw);
print $dst $raw;
@@ -85,7 +85,7 @@ for my $charset (sort keys %Charset){
if (PerlIO::Layer->find('perlio')){
binmode($src, ":utf8");
$uni = join('', <$src>);
- }else{ # ugh!
+ } else { # ugh!
binmode($src);
$uni = join('', <$src>);
Encode::_utf8_on($uni);
@@ -99,6 +99,7 @@ for my $charset (sort keys %Charset){
open $dst,">$dst_enc" or die "$dst_utf : $!";
binmode($dst);
+ binmode($dst, ":bytes"); # in case LC_ALL is UTF8ish
print $dst $txt;
close($dst);
is(compare_text($src_enc, $dst_enc), 0 => "$dst_enc eq $src_enc")
diff --git a/ext/Encode/t/guess.t b/ext/Encode/t/guess.t
index 563bc6feb3..fc71275468 100644
--- a/ext/Encode/t/guess.t
+++ b/ext/Encode/t/guess.t
@@ -48,6 +48,7 @@ my $jisx0208 = File::Spec->catfile(dirname(__FILE__), 'jisx0208.utf');
my $jisx0212 = File::Spec->catfile(dirname(__FILE__), 'jisx0212.utf');
open my $fh, $jisx0208 or die "$jisx0208: $!";
+binmode($fh, ":bytes");
$utf8off = join('' => <$fh>);
close $fh;
$utf8on = decode('utf8', $utf8off);
@@ -77,6 +78,7 @@ Encode::Guess->set_suspects(keys %CJKT);
for my $name (keys %CJKT){
open my $fh, $CJKT{$name} or die "$CJKT{$name}: $!";
+ binmode($fh, ":bytes");
$utf8off = join('' => <$fh>);
close $fh;
diff --git a/ext/Storable/t/malice.t b/ext/Storable/t/malice.t
index 405fd3d5e1..31cbbd13de 100644
--- a/ext/Storable/t/malice.t
+++ b/ext/Storable/t/malice.t
@@ -95,6 +95,7 @@ sub store_and_retrieve {
unlink $file or die "Can't unlink '$file': $!";
open FH, ">$file" or die "Can't open '$file': $!";
binmode FH;
+ eval { binmode(FH, ":bytes") }; # Perl 5.8.0+ only
print FH $data or die "Can't print to '$file': $!";
close FH or die "Can't close '$file': $!";
@@ -258,6 +259,7 @@ sub slurp {
local (*FH, $/);
open FH, "<$file" or die "Can't open '$file': $!";
binmode FH;
+ eval { binmode(FH, ":bytes") }; # Perl 5.8.0+ only
my $contents = <FH>;
die "Can't read $file: $!" unless defined $contents;
return $contents;