Peter J. Holzer schreef:
> Notepad needs the BOM at the beginning of the file to recognize it
> is UTF16, so you have to write that:
With "encoding(UTF-16)", the IO-layer takes care of that. But then you
leave it up to Perl (Encode:

erlIO?) to choose between UTF-16LE and
UTF-16BE. See also perldoc Encode::Unicode.
At opening, the file is 0 bytes, but after printing a single space, it
becomes 4 bytes, with the first two holding the BOM:
#!/usr/bin/perl
use warnings ;
use strict ;
my $fni = 'Araxi.reg' ;
my $fno = 'Araxi1.reg' ;
open my $fhi, '<:encoding(UTF-16)', $fni
or die "open '$fni', stopped $!" ;
open my $fho, '>:encoding(UTF-16)', $fno
or die "open '$fno', stopped $!" ;
print $fho ' ' ;
__END__
--
Affijn, Ruud
"Gewoon is een tijger."