// 中文 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 就行了
本文分享自 作者个人站点/博客 前往查看
如有侵权,请联系 cloudcommunity@tencent.com 删除。
本文参与 腾讯云自媒体同步曝光计划 ,欢迎热爱写作的你一起参与!