#!/usr/bin/env perl
# $Id: weird.pl,v 1.3 2017/07/13 09:06:54 karl Exp karl $
use strict;
use warnings;
use feature qw(say);
my $file = q(weird.txt);
open( my $fh, '>', $file );
binmode $fh, ':encoding(UTF-8)';
say $fh qq(nase\ngöre);
close $fh;
say qx (file -I $file);
say qx(echo \$LANG);
say qx(cat $file);
open( $fh, '<', $file );
binmode $fh, ':encoding(UTF-8)';
say <$fh>;
close $fh;
__END__
####
karls-mac-mini:monks karl$ ./weird.pl
weird.txt: text/plain; charset=utf-8
de_DE.UTF-8
nase
göre
nase
göre
####
karls-mac-mini:monks karl$ ./weird.pl
weird.txt: text/plain; charset=utf-8
de_DE.UTF-8
nase
göre
nase
g?re
####
#!/usr/bin/env perl
# $Id: weird_1nickt.pl,v 1.2 2017/07/13 17:10:29 karl Exp karl $
use strict;
use warnings;
use feature qw(say);
use utf8;
my $file = q(weird.txt);
open( my $fh, '>', $file );
binmode $fh, ':encoding(UTF-8)';
say $fh qq(nase\ngöre);
close $fh;
say qx (file -I $file);
say qx(echo \$LANG);
say qx(cat $file);
open( $fh, '<', $file );
binmode $fh, ':encoding(UTF-8)';
binmode STDOUT, ':encoding(UTF-8)';
say <$fh>;
close $fh;
__END__
karls-mac-mini:monks karl$ ./weird_1nickt.pl
weird.txt: text/plain; charset=utf-8
de_DE.UTF-8
nase
göre
nase
göre
####
#!/usr/bin/env perl
# $Id: weird_choroba.pl,v 1.2 2017/07/13 20:47:38 karl Exp karl $
use strict;
use warnings;
use feature qw(say);
use utf8;
use open IO => ':encoding(utf-8)', ':std';
my $file = q(weird.txt);
open( my $fh, '>', $file );
say $fh qq(nase\ngöre);
close $fh;
say qx (file -I $file);
say qx(echo \$LANG);
say qx(cat $file);
open( $fh, '<', $file );
say <$fh>;
close $fh;
__END__
karls-mac-mini:monks karl$ ./weird_choroba.pl
weird.txt: text/plain; charset=utf-8
de_DE.UTF-8
nase
göre
nase
göre