什么是base 64编码? [英] What is base 64 encoding used for?

查看:134
本文介绍了什么是base 64编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说过这里和那里有人说基地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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆