0

So basically I have use an Api with unicode characters in my angular project . For example &quot and &#039 I tried to use pipes to decode them but there are lots of them . Is there any library or any other way to decode them ?

here is a code if my pipe if it will be helpfull:

 transform(value: string) {
    let finalValue = value;
    if (finalValue.includes(""") || finalValue.includes('“')) {
      finalValue = finalValue.replace(/"/g, '"');
      finalValue = finalValue.replace(/“/g, '"');
    }
    if (finalValue.includes("'") || finalValue.includes('’')) {
      finalValue = finalValue.replace(/'/g, "'");
      finalValue = finalValue.replace(/’/g, "'");
    }
    if (finalValue.includes("&")) {
      finalValue = finalValue.replace(/&/g, "&");
    }


    return finalValue;
  }


medzvre gena
  • 115
  • 1
  • 1
  • 9

0 Answers0