📌  相关文章
📜  在 'window' 上执行 'atob' 失败:要解码的字符串未正确编码. - Javascript代码示例

📅  最后修改于: 2022-03-11 15:03:35.227000             🧑  作者: Mango

代码示例3
function fromBinary(encoded) {
  binary = atob(encoded)
  const bytes = new Uint8Array(binary.length);
  for (let i = 0; i < bytes.length; i++) {
    bytes[i] = binary.charCodeAt(i);
  }
  return String.fromCharCode(...new Uint16Array(bytes.buffer));
}

// our previous Base64-encoded string
let decoded = fromBinary(encoded) // "✓ à la mode"