RE: encoding(UTF16-LE) on Windows

[email protected] (Erland Sommarskog) 20 Jan 2011 08:29:05 -0000
Newsgroups perl.unicode
Organization Erland Sommarskog
Message-ID <[email protected]>
"Jan Dubois" ([email protected]) writes:
> You need to stack the I/O layers in the right order.  The :encoding()
> layer needs to come last (be at the bottom of the stack), *after* the
> :crlf layer adds the additional carriage returns.  The way to pop the
> default :crlf layer is to start out with the :raw pseudo-layer: 
> 
>   open(my $fh, ">:raw:encoding(UTF-16LE):crlf", $filename) or die $!;

Certainly not anywhere close to intuitive. And the explanation is even more 
muddy. "Needs to come last" - it is smack in the middle. "after the :crlf
layer" - it comes before.

One can sense some potential for improvements. Not the least in the 
documentation area.

-- 
Erland Sommarskog, Stockholm, [email protected]