We searched for ways to encode HTML pages on JSP pages to support XSS.
OWASP site shows How_to_perform_HTML_entity_encoding_in_Java
The article talks about the entity encoding "Big 5" ie
21 {"#39", new Integer(39)},
22 {"quot", new Integer(34)},
23 {"amp", new Integer(38)},
24 {"lt", new Integer(60)},
25 {"gt", new Integer(62)},
i.e.
<script>
encoded as
<script>
but the Java code sample included in the article uses numerical reference encoding ie
<script></script>
encoded as
<script></script>
Is there a reason to use character references over entity references? Which is better and why?
source
share