in reply to Redirecting STDERR to STDOUT with UTF8 layer

Something else I've noticed. According to perlfunc, if you try to re-open STDOUT or STDERR as an "in memory" file, you have to close it first, implying that if you want to re-open it to as a file, you DON'T need to close it first.

However, if you don't close it first, then the ':utf8' layer won't be applied:

#!/usr/bin/perl use strict; use warnings; my $utf8="\xe9"; open STDOUT, ">>:utf8", 'test.txt' or die $!; print "No close: ",$utf8,"\n"; close STDOUT; open STDOUT, ">>:utf8", 'test.txt' or die $!; print "Close: ",$utf8,"\n"; PRINTS: No close: \xe9 (not literally - prints character \xe9, not UTF- +8 encoded) Close: é

Clint

Update: Filed as bug 44703