Re: test for ascii or binary string
| From: | Paul Chvostek | Date: | Sat, 30 Nov 2002 04:34:50 +0000 |
| Subject: | Re: test for ascii or binary string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-126523@lists.php.net to get a copy of this message | ||
On Fri, Nov 29, 2002 at 10:27:05PM -0600, Jonathan Sharp wrote:
>
> Is there a way to determine if a string has ascii or binary data in it?
You could always see if it matches a regular expression that represents
the ascii range you're considering. I.e., ereg('[^a-zA-Z0-9]',$string)
will return true if non-alphanumerics are in the string.
Remember that a string is just a string. Whether the data contained in
it is represented as ASCII or something else is completely a matter of
implementation. ALL 7-bit data can be represented as ASCII. All 8-bit
data can be represented as "IBM Extended ASCII" or whatever you want to
call it. But the string is just a string of bits.
--
Paul Chvostek <paul@it.ca>
Operations / Abuse / Whatever +1 416 598-0000
it.canada - hosting and development http://www.it.ca/