my $text = "\xCE\xA9"; # Omega, UTF-8 encoded
print $text; # prints OK
open FH, ">:utf8", "myfile" or die $!;
print FH $text; # wrong: C3 8E C2 A9
####
use Encode;
my $text = decode("UTF-8", "\xCE\xA9");
print $text; # wrong: "Wide character in print at..."
open FH, ">:utf8", "myfile" or die $!;
print FH $text; # OK
####
use Encode;
my $text = decode("UTF-8", "\xCE\xA9");
binmode STDOUT, ":utf8";
print $text; # OK
open FH, ">:utf8", "myfile" or die $!;
print FH $text; # OK
####
my $text = "\xCE\xA9";
print $text; # OK
open FH, ">", "myfile" or die $!; # no PerlIO encoding layer
print FH $text; # OK
####
print "is Omega" if $text =~ /\x{03A9}/; # doesn't match!