Javascript - atob in base64 returning string with special characters.
I tried to use some suggested solution found but it didn't work for me.
Like for example:
function b64DecodeUnicode(str) {
return decodeURIComponent(atob(str).split('').map(function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
}
console.log(b64DecodeUnicode('b64...'));
Result:
return decodeURIComponent(atob(str).split('').map(function(c) {
^
URIError: URI malformed
This base64 represents this image:
On this site you can convert it to base64: converter
I need to decode base64. This function will be used by multiple files and not just this image.
The expected string starts like this:
ÿØÿà JFIF ÿþ Compressed by jpeg-recompressÿÛ C