Hi,
wouldnÂt it be nice to have a pluggable interface for those issues? Setting escape to false requires the user to encode all characters to valid html/xml. We also have a requirement to print <sup> or <sub> markups which replaces special chars in the strings. That interface could be retrieved and registered through an Application sub class.
Mathias
Oliver Rossmueller wrote:
Sylvain Vieujot wrote:
By default, HTMLEncoder.encode( txt ) doesn't encode \n to <br/>. So, <h:outputText> doesn't encode the new lines either.
Is this expected ?
My guess would be that by default, the new lines should be encoded.
Sylvain,
to not encode newline characters is expected behaviour, the spec does not require h:outputText to encode newlines. There is only the requirement that
"characters that are sensitive in HTML and XML markup must be escaped"
when the encode flag is set to true (which is the default). So if you need <br /> for newlines in your text you have to do it on your own (and don't forget to set encode="false" for the h:outputText in this case otherwise the <br/>s will end up on the user's screen).
Oliver
Sylvain.
