export function b64EncodeUnicode ( str ) { return btoa ( encodeURIComponent ( str ) . replace ( /%([0-9A-F]{2})/g , ( _ , p1 ) => { return String . fromCharCode ( parseInt ( p1 , 16 ) ) ; } ) ) ; } export function b64DecodeUnicode ( str ) { return decodeURIComponent ( Array . prototype . map . call ( atob ( str ) , ( c ) => { return '%' + ( '00' + c . charCodeAt ( 0 ) . toString ( 16 ) ) . slice ( - 2 ) ; } ) . join ( '' ) ) ; }