So i saw this thread here which talks about converting non-ASCII characters to their closest ASCII equivalent. The given solution is:
var str = "Rånades på Skyttis i Ö-vik";
var combining = /[\u0300-\u036F]/g;
console.log(str.normalize('NFKD').replace(combining, ''));
Now my issue is similar but not the same. I am looking at replacing special characters like Left Double Quotation Mark which is hex “
or entity “
. The problem is that i can't use the hex code, html entity or any form of encoding. I need to replace special characters like this with their closest standard UTF-8 Character like a normal Double Quotation Mark. The reason being is that the final product is going into an email subject line and no encoding can be present there on some clients, so i'm looking for a JS solution.
It can't be a straight mapping either because it might not be a quotation mark, it could be any kind of symbol. Like an mdash which needs to become a normal dash.