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

Re: RFC: Making -B and -T work better on 8-bit encodings

Thread Previous | Thread Next
From:
Ed Avis
Date:
May 6, 2014 19:09
Subject:
Re: RFC: Making -B and -T work better on 8-bit encodings
Message ID:
loom.20140506T125918-605@post.gmane.org
Karl Williamson <public <at> khwilliamson.com> writes:

>It seems to me that every true binary file will contain plenty of NULs, 
>so it seems overkill to look at anything else

Perhaps so, but in that case not every non-binary file is text.  It might be
some structured format like ASN.1 which cannot be printed as text but happens
not to contain any \0 bytes either.  Then there are images in simple formats
like Windows .BMP or .ICO, where if there are no black pixels there might not
be any zero bytes either.

For the purposes of Perl's file tests, 'binary' should mean 'any format which
cannot be printed intelligibly as text in the console or a text editor'.  So
I think you should check a bit more than just the absence of zero bytes.

-- 
Ed Avis <eda@waniasset.com>


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