zoukankan      html  css  js  c++  java
  • 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  二进制安全 既可以保存文本,还可以保存二进制数据

  • 相关阅读:
    js 与 asp.net 验证控件冲突解决方法
    图片处理(给图片加水印)
    JS打开窗口
    ASP.NET编程中的十大技巧
    【ASP.NET】FCKeditor 2.6 + Asp.Net 设置
    XML文件设置树形结构(无限级)原创
    利用vs.net快速开发windows服务(c#) (转载)
    C#反射 学习
    C#解压RAR压缩文件(转载测试通过)
    SQL显示字段信息
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8229171.html
Copyright © 2011-2022 走看看