为什么Javascript`atob()`和`btoa()`这样命名? [英] Why were Javascript `atob()` and `btoa()` named like that?

查看:312
本文介绍了为什么Javascript`atob()`和`btoa()`这样命名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Javascript中, window.atob()方法解码 base64 字符串和 window.btoa()方法将字符串编码到 base64

In Javascript, window.atob() method decodes a base64 string and window.btoa() method encodes a string into base64.

然后为什么没有他们命名为 base64Decode() base64Encode()
atob() btoa()没有意义,因为它们根本不是语义。

Then why weren't they named like base64Decode() and base64Encode()? atob() and btoa() don't make sense because they're not semantic at all.

我想知道原因。

推荐答案

atob() btoa()方法允许作者将内容转换为base64编码。

The atob() and btoa() methods allow authors to transform content to and from the base64 encoding.


在这些API中,出于助记的目的,b可以被认为是
代表二进制,而a代表 ASCII。但实际上,对于
主要是历史原因,这些
函数的输入和输出都是Unicode字符串。

In these APIs, for mnemonic purposes, the "b" can be considered to stand for "binary", and the "a" for "ASCII". In practice, though, for primarily historical reasons, both the input and output of these functions are Unicode strings.

来自: http://www.w3.org/TR/html/webappapis.html#atob

这篇关于为什么Javascript`atob()`和`btoa()`这样命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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