0

I am using DomSanitizer to search if there are any scripts inside an message(a formgroup of the site). The scripting part works, but if I use any accent inside the message, it get's changed . How to solve this?

this.formGroup.value.message= this.sanitizer.sanitize( SecurityContext.HTML, this.formGroup.value.message );

Sent message: "é"

content in BD:

message content

enter image description here

What's the best way to convert it for the user? And in your opinion, convert it back to normal in the backend or front?

user190245
  • 1,027
  • 1
  • 15
  • 31
Guilherme
  • 1
  • 1
  • If you aren’t allowing user-provided HTML (where `é` should be equivalent to `é`), you don’t need to (and shouldn’t) search for scripts inside a message. (n.b. DomSanitizer would also be the wrong way to search for scripts for non-sanitizing reasons.) – Ry- May 18 '23 at 21:07

0 Answers0