Binary safe
https://en.wikipedia.org/wiki/Binary-safe
A 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的更多相关文章
- redis 源码阅读 内部数据结构--字符串
redis的内部数据结构主要有:字符串,双端链表,字典,跳跃表. 这里主要记录redise字符串的设计.相关的源码位于:src/sds.h 和 src/sds.c. 一 字符串 sds的结构体 s ...
- redis入门笔记(1)
redis入门笔记(1) 1. Redis 简介 •Redis是一款开源的.高性能的键-值存储(key-value store).它常被称作是一款数据结构服务器(data structure serv ...
- Redis快速入门详解
Redis入门详解 Redis简介 Redis安装 Redis配置 Redis数据类型 Redis功能 持久化 主从复制 事务支持 发布订阅 管道 虚拟内存 Redis性能 Redis部署 Redis ...
- PHP内核探索之变量(7)- 不平凡的字符串
切,一个字符串有什么好研究的. 别这么说,看过<平凡的世界>么,平凡的字符串也可以有不平凡的故事.试看: (1) 在C语言中,strlen计算字符串的时间复杂度是?PHP中呢? ...
- PHP filesystem attack vectors
http://www.ush.it/2009/02/08/php-filesystem-attack-vectors/ On Apr 07, 2008 I spoke with Kuza55 and ...
- Redis 数据库
Redis 服务器 Remote Dictionay Server Redis是一个key-value持久化产品,通常被称为数据结构服务器. Redis的key是string类型: ...
- Redis 设计与实现读书笔记一 Redis字符串
1 Redis 是C语言实现的 2 C字符串是 /0 结束的字符数组 3 Redis具体的动态字符串实现 /* * 保存字符串对象的结构 */ struct sdshdr { // buf 中已占用空 ...
- function 的声明
<?php function test() { echo "abc"; } test(); ?> 结论: 一 编译 a.对 函数声明进行词法分析和语法分析:在语法分析中 ...
- redis入门教程
21) Redis 简介Redis 是一个开源的使用 ANSI C 语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value 数据库.2) 数据类型2.1. Redis 的 KeyRedi ...
随机推荐
- python circle nested
#!/usr/bin/python # -*- coding:utf- -*- # @filename: tmp2 # @author:vickey # @date: // : def circle_ ...
- android 获取application和activity下meta-data中的值
meta-data在AndroidManifest中是以键值对的形式存在的,可以将meta-data放在application根节点下,也可以放在某个activity节点下.因为存放的位置不同,因此获 ...
- js正则表达式,只允许输入纯数字或‘/’
//输入框,限数字和/----需要多个数量询价,请以/分隔 function onlyonce(obj) {//先把非数字的都替换掉,除了数字和.obj.value = obj.value.repla ...
- [JOYOI] 自然数拆分Lunatic版
题目背景 话说小小鱼看了P1171(自然数拆分)之后感觉异常不爽,于是异常邪恶地将题目加强. 题目描述 输入自然数n,然后将其拆分成由若干数相加的形式,参与加法运算的数可以重复. 输入格式 输入只有一 ...
- 灰度直方图均衡化----python实现
直方图均衡化是使用图像直方图进行对比度调整的图像处理的方法. 该方法通常会增加许多图像的整体对比度,尤其是当图像的可用数据由接近的对比度值表示时. 通过这种调整,强度可以更好地分布在直方图上. 这允许 ...
- HDU3032 nim博弈
题目大意: 可以从某一堆中取任意个数,也可把一堆分成两个不为0的堆,直到某一方无法操作为输 因为是nim博弈,所以只要考虑一堆时候的sg值,把所有堆的sg值异或即可 很显然这里 0 是一个终止态 sg ...
- 2-sat相关知识
转载:http://blog.csdn.net/luyuncheng/article/details/15172827 此题好纠结啊...其实2-sat关键是建边 此题网上好多题解都是直接说了建边而且 ...
- 【BZOJ3925】地震后的幻想乡(期望概率DP,状压DP)
题意:给定一张点数不超过10的无向连通图,每条边有一个[0,1]之间的随机权值,求最小生成树上最大边的期望值 提示:对于n个[0,1]之间的随机变量x1,x2,...,xn,第k小的那个的期望值是k/ ...
- Tyvj 1176 火焰巨魔的惆怅
Tyvj 1176 火焰巨魔的惆怅 背景 TYVJ2月月赛第一道 巨魔家族在某天受到了其他种族的屠杀,作为一个英雄,他主动担任了断后的任务,但是,在巨魔家族整体转移过后,火焰巨魔却被困住了,他出逃的方 ...
- Linux下汇编语言学习笔记47 ---
这是17年暑假学习Linux汇编语言的笔记记录,参考书目为清华大学出版社 Jeff Duntemann著 梁晓辉译<汇编语言基于Linux环境>的书,喜欢看原版书的同学可以看<Ass ...