快速解碼base64和utf-8的ASCII編碼和URL解碼

看論壇上老是有人發亂七八糟的文字,根本看不懂,用下面的方法解密一下.git

只要有瀏覽器的開發者工具就好了.github

UTF-16解碼瀏覽器

console.log("\u5475\u5475")函數

 

URL解碼(在ES6中被標記爲Draft)工具

unescape("%u5475%u5475")spa

 

Base64解碼code

decodeURIComponent(escape(atob( "5ZG15ZG1=" )));orm

 

使用函數:開發

function utf8_to_b64( str ) {
  return window.btoa(unescape(encodeURIComponent( str )));
}string

function b64_to_utf8( str ) {
  return decodeURIComponent(escape(window.atob( str )));
}

 

base64加解碼庫:

https://github.com/dankogai/js-base64

加解碼說明:

https://developer.mozilla.org/en-US/docs/Web/API/WindowBase64/Base64_encoding_and_decoding

相關文章
相關標籤/搜索