-2

I want to use an HTML Entity Encoder for my HTML <div>${data}</div> I was using ESAPI library ESAPI.encoder().encodeForHTML But I am not sure if it is correct, because for instance, the result of encoding test/a/2 using ESAPI.encoder().encodeForHTML is test&#x2f;a&#x2f;2 (that's what I see in my JSP using :

<div><esapi:encodeForHTML>${deviceKey}</esapi:encodeForHTML></div>

but on this site http://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder the result is test/a/2 (?!) Why ?

1 Answers1

0

ESAPI is almost unsupported due to a lack of interest in maintaining the platform; we'd love to have more active developers.

If you're doing active Ajax replacing of divs, you should look into safe templating and SCE in AngularJS as a replacement for ESAPI.

https://docs.angularjs.org/api/ngSanitize/service/$sanitize https://docs.angularjs.org/api/ng/service/$sce

vanderaj
  • 341
  • 2
  • 4