JS中 atob 方法解码中文字符乱码问题 luckzack 2023-10-13 104 阅读1分钟 // 中文 base64 编码 function utf8_to_b64(str) { return window.btoa(unescape(encodeURIComponent(str))); } // 中文 base64 解码 function b64_to_utf8(str) { return decodeURIComponent(escape(window.atob(str))); } 非中文的话直接用 btoa 和 atob 就行了