JSFiddle - React, Tailwind, and code Playground
by der_robert
JavaScript
function b64EncodeUnicode(str) {
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g,
function toSolidBytes(match, p1) {
return String.fromCharCode('0x' + p1);
}));
}
function utf8_to_b64( str ) {
return window.btoa(unescape(encodeURIComponent( str )));
}
var test = '{"sRegVorname":"asd","sRegName":"asd","sRegEmail":"[email protected]","iPK_Institut":"83","sRegBankSearch":"Kreissparkasse Köln","TabView":"1"}';
//var json = JSON.stringify( {test: test} );
//console.log(json);
console.log(utf8_to_b64(test));
// var_dump(base64_decode("w7bDpMO8w5bDhMOcP8OfPSkoLyYlJMKnIiEpe1tdfWAj"));