develooper Front page | perl.perl5.porters | Postings from August 2006

Re: [perl #40255] :encoding(UTF16), Windows, \n -> 00 0D 0A

From:
Dr.Ruud
Date:
August 30, 2006 15:17
Subject:
Re: [perl #40255] :encoding(UTF16), Windows, \n -> 00 0D 0A
Message ID:
20060830221718.25876.qmail@lists.develooper.com
rvtol+perlbug @ isolution . nl schreef:


> #!/usr/bin/perl
>
> # $ID: utf16.pl $
>
>   use warnings ;
>   use strict ;
>
>   my ($fno, $eo) = ('utf16.txt', ':encoding(UTF16)') ;
>
>   open my $fho, ">$eo", $fno  or die "open '$fno': $!" ;
>
>   print $fho "\n" ;
>
> __END__
>
> results in a 5 byte file:
>
>   FE FF 00 0D 0A
>
> where I expect 6 bytes:
>
>   FE FF 00 0D 00 0A
>
> so I guess the :crlf is in the wrong position of the layer stack.

Work-around: ':raw:encoding(UTF-16):crlf'
(see news:slrnefabt9.pgb.hjp-usenet2@yoyo.hjp.at)

-- 
Affijn, Ruud

"Gewoon is een tijger."





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About