I work with a backend service that sends me back base64 in plain text.
When I log it in the console, copy/paste in Base64Decode, I can see my string contains line break, this is what I want.
But when I use functions to convert this base64 string into UTF-8 one, break lines are lost.
What I tried :
function b64DecodeUnicode(str) {
return decodeURIComponent(Array.prototype.map.call(atob(str), function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
}).join(''))
}
This solution comes from here, but is not working.