//base64加密
function b64EncodeUnicode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
return String.fromCharCode('0x' + p1);
}));
}
var str= b64EncodeUnicode('[{name:"zhangsan",icon:"122.jpg"}]');
//base64解密
function b64DecodeUnicode(str) {
return decodeURIComponent(atob(str).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
}

相关文章:

  • 2021-06-15
  • 2022-12-23
  • 2022-12-23
  • 2021-07-19
  • 2021-07-20
  • 2021-08-21
  • 2022-02-24
猜你喜欢
  • 2021-07-22
  • 2021-12-07
  • 2021-11-13
  • 2021-10-29
  • 2022-12-23
  • 2021-09-14
相关资源
相似解决方案