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