• 为什么要用base64编码


    1.需求

    了解为什么要使用base64对数据编码

    2.理由

    因为传输二进制数据的时候,网络中间的有些路由会把ascii码中的不可见字符删了,导致数据不一致。一般也会对url进行base64编码

    When you have some binary data that you want to ship across a network, you generally don't do it by just streaming the bits and bytes over the wire in a raw format. Why? because some media are made for streaming text. You never know -- some protocols may interpret your binary data as control characters (like a modem), or your binary data could be screwed up because the underlying protocol might think that you've entered a special character combination (like how FTP translates line endings).

    So to get around this, people encode the binary data into characters. Base64 is one of these types of encodings. Why 64? Because you can generally rely on the same 64 characters being present in many character sets, and you can be reasonably confident that your data's going to end up on the other side of the wire uncorrupted.

     

    参考资料:

    https://www.zhihu.com/question/36306744/answer/71626823

    https://segmentfault.com/q/1010000000801988/a-1020000002230260

    http://blog.xiayf.cn/2016/01/24/base64-encoding/

    http://blog.csdn.net/benbenxiongyuan/article/details/7756912

  • 相关阅读:
    这是一棵树吗
    感染者
    es6 语法
    css3 flex 详解,可以实现div内容水平垂直居中
    移动端实现复制内容至剪贴板小例子
    jq+mui 阻止事件冒泡
    移动端H5 判断IOS还是Android 平台
    移动端布局 rem,和px
    关于H5移动端开发 iPhone X适配
    H5 微信公众号 监听返回事件
  • 原文地址:https://www.cnblogs.com/norm/p/6259310.html
Copyright © 2020-2023  润新知