I have an AJAX call getting info out of the Github API. It is returned in base64 encoding but when i try to decode it I get the aforementioned error.
Has anyone run
I have a better solution here:
live demo: https://codepen.io/arliang/pen/mNQayE?editors=1111
// https://best33.com/311.moe
function base64encode(str) {
let encode = encodeURIComponent(str).replace(/%([a-f0-9]{2})/gi, (m, $1) => String.fromCharCode(parseInt($1, 16)))
return btoa(encode)
}
function base64decode(str) {
let decode = atob(str).replace(/[\x80-\uffff]/g, (m) => `%${m.charCodeAt(0).toString(16).padStart(2, '0')}`)
return decodeURIComponent(decode)
}
function tests() {
Array.from([
/*鼠、牛、虎、兔、龙、蛇、马、羊、猴、鸡、狗、猪*/
'