1 #!/usr/local/bin/perl -w
9 plan skip_all => 'Older Perl lacking unicode support'
18 my $is_win32 = $^O =~ /win32/i ;
20 my $orig_text = "\x{20ac}\n" ;
21 ( my $win32_text = $orig_text ) =~ s/\n/\015\012/ ;
22 my $unicode_length = length $orig_text ;
24 my $control_file = "control.$suf" ;
25 my $slurp_file = "slurp.$suf" ;
27 open( my $fh, ">$mode", $control_file ) or
28 die "cannot create control unicode file '$control_file' $!" ;
29 print $fh $orig_text ;
32 my $slurp_utf = read_file( $control_file, binmode => $mode ) ;
33 my $written_text = $is_win32 ? $win32_text : $orig_text ;
34 is( $slurp_utf, $written_text, "read_file of $mode file" ) ;
36 # my $slurp_utf_length = length $slurp_utf ;
37 # my $slurp_text = read_file( $control_file ) ;
38 # my $slurp_text_length = length $slurp_text ;
39 # print "LEN UTF $slurp_utf_length TXT $slurp_text_length\n" ;
41 write_file( $slurp_file, {binmode => $mode}, $orig_text ) ;
43 open( $fh, "<$mode", $slurp_file ) or
44 die "cannot open slurp test file '$slurp_file' $!" ;
45 my $read_length = read( $fh, my $utf_text, $unicode_length ) ;
48 is( $utf_text, $orig_text, "write_file of $mode file" ) ;
50 unlink( $control_file, $slurp_file ) ;