I have chars in a response that can not be decoded.
Charakters like ß that represents ß and – that represents a - are causing the exception and these chars like ß and - is what i want at the end. What i am doing right now is replacing the chars that throws an exception before calling decodeURIComponent().
I know it's bad but i don't know how to handle that correctly.
var jsonResponse = "WG_ Ihre Buchung ist bestätigt – 1232456201 FRANKFURT AM MAIN Oktober 16_ 2020 nach Mußterstadt, Mußterstraße 11, Oktober 17_ 2020.msg";
var finalString = jsonResponse.replace(/ß/g,"ss").replace(/–/g,"-");
console.log("escaped String: "+ escape(finalString));
var decoded = decodeURIComponent(escape(finalString));
console.log(decoded);
How can I convert this correctly?