1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Uncaught DOMException: Failed to execute ‘btoa‘ on ‘Window‘: The string to be encoded contains chara

Uncaught DOMException: Failed to execute ‘btoa‘ on ‘Window‘: The string to be encoded contains chara

时间:2018-12-09 14:04:52

相关推荐

Uncaught DOMException: Failed to execute ‘btoa‘ on ‘Window‘: The string to be encoded contains chara

Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

解决方法:

使用window.btoa加密失败,报错如下:

Uncaught DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.

原因是加密的的字符串中有特殊字符那些,所以得先使用encodeURIComponent编码再加密。

具体实现可参考:execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range_码上敲享录

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。