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
#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);
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;
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;
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;
if (PerlIO::Layer->find('perlio')){
binmode($src, ":utf8");
$uni = join('', <$src>);
- }else{ # ugh!
+ } else { # ugh!
binmode($src);
$uni = join('', <$src>);
Encode::_utf8_on($uni);
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")
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);
for my $name (keys %CJKT){
open my $fh, $CJKT{$name} or die "$CJKT{$name}: $!";
+ binmode($fh, ":bytes");
$utf8off = join('' => <$fh>);
close $fh;
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': $!";
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;