0

I need to decode this UTF-8 string: j&#X41vascript.

I have tried doing:

decodeURIComponent(escape('j&#X41vascript'))

which did not work, it returned the same string back.

Eventually, I would want to prevent the XSS attack originating from the attacker entering an input string like:

<IMG SRC=j&#X41vascript:alert('test2')>

Source: https://www.owasp.org/index.php/Cross-site_Scripting_(XSS)

How do I fix this?

Rahul Desai
  • 15,242
  • 19
  • 83
  • 138

0 Answers0