Binary-safe

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Binary-safe is a computer programming term 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).

[edit] Special characters

Most functions are not binary safe when using any special or markup characters, such as escape codes or those that expect null-terminated strings. A possible exception would be a function whose explicit purpose is to search for a certain character in a binary string.

[edit] Data format

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. The length of the data must be known by the function in order to operate on the entirety of the data.

Personal tools
Namespaces
Variants
Actions
Navigation
Interaction
Toolbox
Print/export