By default, $escapetool.html()
escapes basic 4 characters ("
, &
, <
, >
) and a set of ISO-8859-1 characters. I believe (but might be wrong) that XWiki extensions should only use UTF-8 encoding, meaning that in our context we only see the 4 basic characters actually escaped. The most notable difference between the two is thus the output, since HTML escaping returns HTML entity codes while XML escaping returns numerical XML entities.
$escapetool.html()
was recently extended to also escape {
and }
, but $escapetool.xml()
already had support for curly braces for nearly a year.
So in practice, in the context of XWiki, the XML escape tool actually supersedes the HTML escape tool (it also escapes single quote symbols).
The suggestion for deprecation mostly comes from the fact that one implementation (the most used) was more maintained than the other one (which was still Velocity’s default implementation until recently).
While I do agree, this does not reflect the current code base where xml()
is already preferred over html()
, even for HTML content.
I also agree on this. At the very least, since they do not return the same kinds of entities, they should never be synonyms.