Binary-safe
From Wikipedia, the free encyclopedia
Binary-safe is mainly used in connection with string manipulating functions. A binary-safe function is essentially one that treats its input as a raw stream of data without any specific format. It should thus work with all 256 possible values that a character can take (assuming 8-bit characters). Most functions using any special or markup characters, such as escape codes or those that expect null-terminated strings are not binary safe. A possible exception would be a function whose explicit purpose is to search for a certain character in a binary string.
Binary safe functions are required when working with data of unknown format (otherwise the format would not be preserved) such as arbitrary files, encrypted data, and the like.
Clearly the length of the data must be known by the function in order to operate on the entirety of the data.