Re: encoding(UTF16-LE) on Windows

[email protected] (Bob Hallissy) Thu, 20 Jan 2011 21:40:09 -0600
Newsgroups perl.unicode
Message-ID <[email protected]>
--------------020500040904030803040007
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit


Jan Dubois wrote:
> Files opened on Windows already have the :crlf layer pushed by default,
> so you somehow need to get the :encoding layer*below*  it.

Is it possible to re-write the working statement

       open(my $fh, ">:raw:encoding(UTF-16LE):crlf", $filename) or die $!;

in a way that works correctly on any platform (without referring to $^O) ?

Bob

--------------020500040904030803040007
Content-Type: text/html; charset=windows-1252
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    <br>
    Jan Dubois wrote:
    <blockquote
      cite="mid:[email protected]"
      type="cite">
      <pre wrap="">Files opened on Windows already have the :crlf layer pushed by default,
so you somehow need to get the :encoding layer <b class="moz-txt-star"><span class="moz-txt-tag">*</span>below<span class="moz-txt-tag">*</span></b> it.</pre>
    </blockquote>
    <br>
    Is it possible to re-write the working statement <br>
    <blockquote>
      <pre wrap="">  open(my $fh, "&gt;:raw:encoding(UTF-16LE):crlf", $filename) or die $!;</pre>
    </blockquote>
    in a way that works correctly on any platform (without referring to
    $^O) ?<br>
    <br>
    Bob<br>
  </body>
</html>

--------------020500040904030803040007--