diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-30 08:30:35 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2007-03-30 08:30:35 +0000 |
commit | f0720f70fca1466afb0baffc79f6af7a9e80f428 (patch) | |
tree | 5f84f35ed750de7ac065a725050b8356cbab4fc0 /t/io | |
parent | abc718f2ca5cfe66c838e1324c1c153a085fea8b (diff) | |
download | perl-f0720f70fca1466afb0baffc79f6af7a9e80f428.tar.gz |
When dup'ing a filehandle, retain the :utf8 layer
p4raw-id: //depot/perl@30781
Diffstat (limited to 't/io')
-rwxr-xr-x | t/io/dup.t | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/t/io/dup.t b/t/io/dup.t index 48497fd232..0287023301 100755 --- a/t/io/dup.t +++ b/t/io/dup.t @@ -10,7 +10,7 @@ use Config; no warnings 'once'; my $test = 1; -print "1..26\n"; +print "1..29\n"; print "ok 1\n"; open(DUPOUT,">&STDOUT"); @@ -133,5 +133,25 @@ SKIP: { } close G; + use utf8; + open UTFOUT, '>:utf8', "dup$$" or die $!; + open UTFDUP, '>&UTFOUT' or die $!; + my $message = "ça marche pas\n"; + print UTFOUT $message; + print UTFDUP $message; + binmode UTFDUP, ':utf8'; + print UTFDUP $message; + close UTFOUT; + close UTFDUP; + open(UTFIN, "<:utf8", "dup$$") or die $!; + { + my $line; + $line = <UTFIN>; is($line, $message); + $line = <UTFIN>; is($line, $message); + $line = <UTFIN>; is($line, $message); + } + close UTFIN; + no utf8; + END { 1 while unlink "dup$$" } } |