https://en.wikipedia.org/wiki/Binary-safe

binary-safe function is one that treats its input as a raw stream of bytes and ignores every textual aspect it may have. The term is mainly used in the PHP programming language to describe expected behaviour when passing binary data into functions whose main responsibility is text and string manipulating, and is used widely in the official PHP documentation.[1]

Binary-safe file read and write

While all textual data can be represented in binary-form, it must be done so through character encoding. In addition to this, hownewlines are represented may vary depending on the platform used. Windows, Linux and macOS all represent newlines differently in binary form. This means that reading a file as binary data, parsing it as text and then writing it back to disk (thus reconverting it back to binary form) may result in a different binary representation than the one originally used.

Most programming languages let the programmer decide whether to parse the contents of a file as text, or read it as binary data. To convey this intent, special flags or different functions exists when reading or writing files to disk. For example, in the PHP programming language, developers have to use fopen($filename, "rb") instead of fopen($filename, "r") to read the file as a binary stream instead of interpreting the textual data as such. This may also be referred to as reading in 'binary safe' mode.

c字符串,二进制不安全, 只能保存文本

redis simple dynamic string  二进制安全 既可以保存文本,还可以保存二进制数据

Binary safe的更多相关文章

  1. redis 源码阅读 内部数据结构--字符串

    redis的内部数据结构主要有:字符串,双端链表,字典,跳跃表. 这里主要记录redise字符串的设计.相关的源码位于:src/sds.h 和 src/sds.c.   一 字符串 sds的结构体 s ...

  2. redis入门笔记(1)

    redis入门笔记(1) 1. Redis 简介 •Redis是一款开源的.高性能的键-值存储(key-value store).它常被称作是一款数据结构服务器(data structure serv ...

  3. Redis快速入门详解

    Redis入门详解 Redis简介 Redis安装 Redis配置 Redis数据类型 Redis功能 持久化 主从复制 事务支持 发布订阅 管道 虚拟内存 Redis性能 Redis部署 Redis ...

  4. PHP内核探索之变量(7)- 不平凡的字符串

    切,一个字符串有什么好研究的. 别这么说,看过<平凡的世界>么,平凡的字符串也可以有不平凡的故事.试看: (1)       在C语言中,strlen计算字符串的时间复杂度是?PHP中呢? ...

  5. PHP filesystem attack vectors

    http://www.ush.it/2009/02/08/php-filesystem-attack-vectors/ On Apr 07, 2008 I spoke with Kuza55 and ...

  6. Redis 数据库

    Redis 服务器     Remote Dictionay Server     Redis是一个key-value持久化产品,通常被称为数据结构服务器.   Redis的key是string类型: ...

  7. Redis 设计与实现读书笔记一 Redis字符串

    1 Redis 是C语言实现的 2 C字符串是 /0 结束的字符数组 3 Redis具体的动态字符串实现 /* * 保存字符串对象的结构 */ struct sdshdr { // buf 中已占用空 ...

  8. function 的声明

    <?php function test() { echo "abc"; } test(); ?> 结论: 一 编译 a.对 函数声明进行词法分析和语法分析:在语法分析中 ...

  9. redis入门教程

    21) Redis 简介Redis 是一个开源的使用 ANSI C 语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value 数据库.2) 数据类型2.1. Redis 的 KeyRedi ...

随机推荐

  1. torch.nn.Embedding理解

    Pytorch官网的解释是:一个保存了固定字典和大小的简单查找表.这个模块常用来保存词嵌入和用下标检索它们.模块的输入是一个下标的列表,输出是对应的词嵌入. torch.nn.Embedding(nu ...

  2. Bootstrap table的基础用法

    一.官方文档 Bootstrap 中文网:http://www.bootcss.com/ Bootstrap Table 中文网 : http://bootstrap-table.wenzhixin. ...

  3. 级数求和(C++)

    题目描述 已知:Sn​=1+1/2+1/3+…+1/n.显然对于任意一个整数K,当n足够大的时候,Sn​大于K. 现给出一个整数K(1≤K≤15),要求计算出一个最小的n:使得Sn​>K. 输入 ...

  4. HDU4415 Assassin’s Creed

    题目大意:有n个人,每个人有x,y两个值.x代表干掉他得到的分数,分数和不超过m;y代表干掉他后你能额外干掉多少个,且不计入总分. 求干掉人数最多为多少,以及最小的分. ~~~~~~~~~~~~~~~ ...

  5. C++中const与constexpr区别

    对于对象来说 const指的是编译期常量和运行时常量,两者并没有区分 constexpr特指编译期常量 对于函数来说 const可以修饰类的成员函数,被修饰的函数在执行期间不会改变对象的值. clas ...

  6. mysql You can't specify target table 'sys_org_relation' for update in FROM clause 删除表条件不能直接包含该表

    mysql中You can't specify target table for update in FROM clause错误的意思是说,不能先select出同一表中的某些值,再update这个表( ...

  7. http chunked 理解

    https://imququ.com/post/transfer-encoding-header-in-http.html #! /usr/bin/python #coding:utf8 import ...

  8. linux中的命令

    1,ln-链接 功能是为某一个文件在另外一个位置建立一个同步的链接,这个命令最常用的参数是-s,具体用法是: ln -s 源文件 目标文件  // -s 是 symbolic(符号,象征)的意思. l ...

  9. Git--使用须知123

    详细的篇幅以后补充 安装篇: 设置篇: 由于我们大多数是windows程序员,那么,在使用git的过程前需要做一些设置项. 1.换行符自动转换. 查看:git config --global --li ...

  10. Codeforces Round #355 (Div. 2)-B. Vanya and Food Processor,纯考思路~~

    B. Vanya and Food Processor time limit per test 1 second memory limit per test 256 megabytes input s ...