Re: What's a binary safe function?

From: Date: Mon, 19 May 2003 12:49:18 +0000
Subject: Re: What's a binary safe function?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148156@lists.php.net to get a copy of this message
On Sun, 18 May 2003 19:28:24 -0700 (PDT), you wrote: >I don't have so clear the phrase "binary safe" >function. > >Is a binary safe function one that will correctly >recognize all data, rather than only ASCII text? I think you already got it :) All "regular" ASCII characters (the ones you can type on an English keyboard) have numbers less than 128. Eg a = 97 = 01100001 A = 65 = 01000001 % = 37 = 00100101 As you can see, all these characters have their first bit set to 0. The binary characters that give some software problems are those ASCII characters above 128 (those with their first bit set to 1), and \0 (00000000). \0 is included because in many languages (those descended from C), \0 signifies the end of a string. Binary-safe code is code you can throw any ASCII value at, including those >128 and \0, and it will work correctly.

« previous php.general (#148156) next »