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
Ed Avis
May 6, 2014 19:09
Re: RFC: Making -B and -T work better on 8-bit encodings
Message ID:
Karl Williamson <public <at>> 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 <>

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About