sorry...you didn't understand... in my bean I have 'à'; then HTMLEncoder transforms it in à. But now I understood the real problem: it should to be transformed in à and not in à because when application decodes it (in my case this work is done by tomcat) , it calculate &amp as & but #224 remains so because it is without & at the start. At the end I will get #224 instead of 'à'

david delbecq ha scritto:

In example below, facelet is not involved, as the value is not present in the xhtml file (that' where the xml parser used by facelets resolves entities and converted them to java string. If you want to put an agrave in your bean property, encode it in the bean as "à", nothing else! As for your comment that it uses iso-8859-1, it's supposed to use the current encoding used by responseWriter, which itselef uses the content-encoding used for response, which i think is configurable in faces-config.xml


Luca Stancapiano a écrit :
hi david... thanks for your response... I correct the value viewed into the final page... it is :

modalit&#224

I ignore encoding type but I presume to be the default because I didn't set it ..... this application uses myfaces + facelets.... you tell that decoding is job of facelets?

david delbecq ha scritto:
Luca Stancapiano a écrit :
hi.... I've seen that myfaces executes a strange encoding for characters. If I have something similar:

<h:form> <h:commandLink action="#{UserNumberBean.log}"> <h:outputText value="#{UserNumberBean.modalita}"/> <f:param name="id" value="#{UserNumberBean.modalita}"/>
                   </h:commandLink>
 </h:form>


and UserNumberBean.modalita has 'modalità' as value, I see into the resulted page this value: modalit&#226 ,the ascii code instead of 'modalit&agrave' as well as for html pages. So when I click on the link, this value cannot to be decoded. I think about a bug of HTMLEncoder class... what do you think?
well, &#224 would be correct for an iso-8859-1 encoded response, but 226?? What the encoding used by myfaces in your case. is-8859, utf8? other? The component just use that encoding to convert characters to entities. Using &#....; notation is perfectly correct, event for links. If you have problems with it, it can also comes from the fact you form submit in an inappropriate encoding. use <h:form acceptcharset="...."> to specify expected encoding by server. Of course, you have to configure your server the same way. Here at work we force everything to utf-8.

Reply via email to