perl-unicode

RE: encoding(UTF16-LE) on Windows

2011-01-20 03:47:42
"Jan Dubois" (jand(_at_)activestate(_dot_)com) 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, esquel(_at_)sommarskog(_dot_)se