But to be honest, the problem is that the server side does not know anything about how the client side is using the text.

For example, the server does not know whether you will be using:

alert('#{messages.text1}');

or:

<h:outputText value="#{messages.text1}"/>

For both cases, the HTML entity code is generated:

Cami&#363;n

2005/8/29, Matt Blum <[EMAIL PROTECTED]>:
You're absolutely right about the source of the problem.

It seems to me that a better solution might be to fix the implementation.  I don't see any reason to encode non-standard-ASCII characters with the "&#" encoding if rendering _javascript_--stylesheets, yes, but not _javascript_.  With _javascript_, the Unicode encoding of "\u" should be used.  AFAIK, this should always work.

Does anyone know of any reason why this shouldn't be done?

-Matt


On 8/29/05, Enrique Medina < [EMAIL PROTECTED]> wrote:
Definitively, the problem is that the JSF ResponseWriter always encodes the text generating &#-like strings.

So then a manual replace of these strings must be done within the _javascript_ section of the page :-(

2005/8/29, Enrique Medina < [EMAIL PROTECTED] >:
Hi again,

I've been investigating this issue and the problem is here:

HtmlResponseWriterImpl:
===================
UnicodeEncoder.encode(strValue, false, false)

All write methods use this call to the UnicodeEncoder, so the returned string always contains the &#243 or whatever.


2005/8/25, Matt Blum < [EMAIL PROTECTED] >:
Maybe the ConvertEncoding class in this article from OnJava.com would be useful:

http://www.onjava.com/pub/a/onjava/excerpt/javaexIAN3_chap8/index.html

If not, it might at least give you an idea how to fix your issue.


-Matt


On 8/25/05, Enrique Medina <[EMAIL PROTECTED] > wrote:
Hi Matt,

Yes, the same thing occurs...


2005/8/25, Matt Blum < [EMAIL PROTECTED]>:
What does it do now?  The same thing as before?

-Matt


On 8/25/05, Enrique Medina < [EMAIL PROTECTED]> wrote:
I have tried to define my properties file (resource bundle) using Unicode encodings:

combiVariables_ValidacionOK = La f\u00F3rmula es correcta
combiVariables_ValidacionNotOK = La f\u00F3rmula no es correcta

But it still doesn't work :-(

2005/8/25, Enrique Medina <[EMAIL PROTECTED] >:
Thanks. Let me try it ;-)

2005/8/25, Matt Blum <[EMAIL PROTECTED]>:
I understand that.  I'm suggesting that, instead of "La fórmula es correcta" in your properties file, you put "La f\u00f3rmula es correcta."


-Matt

On 8/24/05, Enrique Medina <[EMAIL PROTECTED] > wrote:
Hi Matt,

But the problem is that encoding is generated by JSF when using EL like this:

#{messages.literal1}

2005/8/24, Matt Blum <[EMAIL PROTECTED]>:
You need to use the Unicode encoding for the character, like so:

"La f\u00f3rmula es correcta"

There's a handy online tool to find the codes for most special characters here:
http://www.saila.com/usage/tips/examples/special_characters.html

-Matt


On 8/24/05, Enrique Medina < [EMAIL PROTECTED] > wrote:
Hi,

I know this is not a question directly related with MyFaces, but does anybody knows how to solve this problem?

I define my literal strings in a properties file, and then I have created a custom messages tag that renders the message as an alert of _javascript_. So when a JSF message is generated, it is rendered as an alert. My problem is with accents. For example, in the alert window the text appears like:

"La f&#243;rmula es correcta"

while it should be:

"La fórmula es correcta"

Is it a matter of escaping the text in _javascript_? Because I have tried the escape() function but with no success...













Reply via email to