Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is a binary safe string?

Tags:

string

redis

What is a binary safe string ? Is it just a string with length attached in the string itself ? Why are they called binary safe then ? Not sure that I should tag redis, but read this term while reading redis doc.

like image 356
Chirag Avatar asked Jun 05 '17 20:06

Chirag


People also ask

What is meant by binary safe?

A binary-safe function is a function or operation that can be performed on a binary file without modifying the contents of the file. This ensures that the file is not corrupted or mutilated by the function or operation.

What does binary safe mean in PHP?

Binary safety is a property of functions which means they process any string correctly. The converse would be a string that contains only ASCII characters and no null characters - such a string should be processed correctly by any function.

What is binary safe in Redis?

Redis keys are binary safe, this means that you can use any binary sequence as a key, from a string like "foo" to the content of a JPEG file. The empty string is also a valid key.


1 Answers

A binary safe string is one that can consist of any characters (bytes).

For example, many programming languages use the 0x00 character as an end-of-string marker, so in that sense a binary safe string is one that can consist of these.

like image 111
Itamar Haber Avatar answered Sep 25 '22 20:09

Itamar Haber