develooper Front page | perl.perl5.porters | Postings from May 2010

Re: [perl #75106] binmode $fh, ":raw" doesn't undo :utf8 on win32

Thread Previous | Thread Next
From:
Ben Morrow
Date:
May 16, 2010 15:26
Subject:
Re: [perl #75106] binmode $fh, ":raw" doesn't undo :utf8 on win32
Message ID:
20100516222646.GA74033@osiris.mauzo.dyndns.org
Quoth ikegami@adaelis.com (Eric Brine):
> On Sun, May 16, 2010 at 9:21 AM, David Golden <xdaveg@gmail.com> wrote:
> 
> > Strangely:
> >
> > C:\david\tmp>perl -MPerlIO -wE "binmode STDOUT; say for
> > PerlIO::get_layers(STDOUT)"
> > unix
> > crlf
> >
> > But further investigation with get_layers() and detail => 1 reveals
> > that crlf just has different flags set depending on whether binmode
> > (raw) is called on STDOUT or not.
> >
> >
> That causes isssues if you try to add :encoding(UTF-16):crlf to a handle
> that previously had :crlf since the layer ordering ends up wrong.

c.f. PerlIO::eol, which may be fractionally less efficient but doesn't
have this bug.

Ben


Thread Previous | Thread Next


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