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:
David Golden
Date:
May 16, 2010 06:21
Subject:
Re: [perl #75106] binmode $fh, ":raw" doesn't undo :utf8 on win32
Message ID:
AANLkTim5--YWiAExgAGxGI3CBSze_fgPbscsK0VOahRo@mail.gmail.com
On Fri, May 14, 2010 at 7:55 PM, Tatsuhiko Miyagawa
<perlbug-followup@perl.org> wrote:
> The following test fails on win32 systems on perl 5.8.9, 5.10.1 and
> 5.12.0, whereas it passes fine on other systems like Linux or Mac OS
> X. It looks like binmode $t, ":raw" doesn't have any effect of taking
> away ":utf8". Per my discussion with jdb at #p5p, i'm filing a bug
> report.

There is an easier workaround:

    binmode($t, ":bytes")

Using that instead of ":raw" will do what you want and cause your tests to pass.

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.

-- David

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