in reply to perl gone wonkers when handling binary data?

Try this:
LANG=en_US strace perl -e 'print "\xff"' 2>&1| grep write
There's a known issue with RH9 and its perl 5.8.0 build; the default LANG setting (en_US.utf8) results in perl running in UTF-8 mode rather than ASCII mode.

The LANG setting sould set things to rights.

(Edit: ysth++ is correct, it's not strictly an RH9 issue. But RH9 does set the default LANG value as utf8, which exposes the perl 5.8.0 issue)


Mike

Replies are listed 'Best First'.
Re: Re: perl gone wonkers when handling binary data?
by ysth (Canon) on Apr 14, 2004 at 16:32 UTC
    It's a little misleading to say "its [RedHat's] perl 5.8.0 build". The fault was with perl5.8.0 in general, which by design assumed STDOUT would expect utf8 if in a utf8 locale. Redhat just was unfortunate in being one of the most prominent platforms to hit the combination of 5.8.0 and the OS defaulting to have a utf8 locale.

    This design was reconsidered in 5.8.1. See perl581delta for more information (including about the new -C switch to explicitly state what STDIN, etc. expect.)

Re: Re: perl gone wonkers when handling binary data?
by cazz (Pilgrim) on Apr 14, 2004 at 18:24 UTC
    yep, that was it. thanks.