什么是 base 64 编码?

编程入门 行业动态 更新时间:2024-10-27 01:31:16
本文介绍了什么是 base 64 编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说人们到处谈论base 64 编码".有什么用?

I've heard people talking about "base 64 encoding" here and there. What is it used for?

推荐答案

当您想要通过网络传输一些二进制数据时,您通常不会仅仅通过网络传输位和字节来实现原始格式.为什么?因为有些媒体是为流文本而制作的.您永远不知道——某些协议可能会将您的二进制数据解释为控制字符(例如调制解调器),或者您的二进制数据可能会被搞砸,因为底层协议可能认为您输入了特殊字符组合(例如 FTP 如何转换行结局).

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).

所以为了解决这个问题,人们将二进制数据编码为字符.Base64 是这些类型的编码之一.

So to get around this, people encode the binary data into characters. Base64 is one of these types of encodings.

为什么是 64?
因为您通常可以依赖存在于许多字符集中的相同 64 个字符,并且您可以合理地确信您的数据将在未损坏的线路的另一端结束.

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.

这篇关于什么是 base 64 编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-03-31 02:15:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/793588.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:base

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!