I use IO::TEE for these kinds of things. Not sure of it will fix your problem though documents say nothing about utf8.
open my $ofh, '>>', 'LOGFILE.txt' or die "Cannot append to 'LOGFILE.tx
my $tee = IO::Tee->new(\*STDOUT, $ofh); # Prints to both file and stdo
#my $tee = IO::Tee->new(\*$ofh);Prints to file only
print $tee "Opening $name";
Worth a shot. Hope it Helps.
Very nice writeup on the previous reply that was a hell of alot of work.