in reply to Re^2: binmode, encoding layer, ignoring encoding problems
in thread binmode, encoding layer, ignoring encoding problems

I've encountered some problems too, as I mentioned. It appears to be a flaky or poorly documented interface. I don't have the time to hunt down the problem, but you could file a bug report and encode manually for now.
open my $fh, ">", "output.txt" or die $!; print $fh encode('latin-1', $euro_in_unicode), "\n"; close $fh;

Update: Taking a hint from the source, the following seems to work. No idea what STOP_AT_PARTIAL means.

#!/usr/bin/perl use strict; use warnings; use PerlIO::encoding; use Encode; my $euro_in_unicode = chr(0x20AC); open my $fh, ">", "output.txt" or die $!; { local $PerlIO::encoding::fallback = Encode::FB_DEFAULT|Encode::STOP_AT_PARTIAL; binmode $fh, ":encoding(latin1)"; } print $fh "$euro_in_unicode\n"; close $fh;