Re[4]: [PHP] Detecting Binaries
| From: | Richard Davey | Date: | Mon, 23 Feb 2004 22:07:09 +0000 |
| Subject: | Re[4]: [PHP] Detecting Binaries | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-178598@lists.php.net to get a copy of this message | ||
Hello Evan,
Monday, February 23, 2004, 8:57:43 PM, you wrote:
>> It would be wise to check for characters from 0 to 31, if they appear
>> then it's almost certainly (but not guaranteed) binary.
EN> Assuming that's decimal, you're including 0x09 0x0a and 0x0d which are,
EN> respectively, tab, line feed, and carriage return. That's off the top of my
EN> head, which means two things: (1) i may be forgetting something, and (2) I
EN> need a life ;)
Let me rephrase - check for the existence of characters 0 through 31
and count how many there are. Set a percentage weight yourself and
figure out in your script if you deem the quantity too many or too
few.
The count_chars() function will be absolutely ideal for this.
--
Best regards,
Richard Davey
http://www.phpcommunity.org/wiki/296.html