Hi Jean-Pierre,
At least we are two on Earth with this behavior, so I can consider it
normal.
Neither the javadoc on Properties nor PropertyResourceBundle cite that you
must double the quote character to have it retrieved from a file (ie
displayed on the HTML).
The PropertyResourceBundle even have an example where a quote appears:
s4=Der disk '{1}' a {0} a {2}.
and it's not doubled.
And you can try as I did to store and load a Property file and see that in
that case, single quotes work...
Well, I have a solution. I can now focus on more important bugs.
Pierre Métras
----- Original Message -----
From: "Jean-Pierre Schnyder" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, November 02, 2000 3:41 AM
Subject: RE: Can't obtain quote characters from struts message file
In all the .properties files I use for handling internationalization in Java
with RessourceBundle's, like in file dispErrorMsg_fr_CH.properties for
example, I always double the quote character, otherwise, the quote is not
displayed to the user. Here's an example, if this is not clear: data0001 =
Enregistrement pour l''ID {0} non trouvé dans la base de données !
The need to double the quote is not a bug I think and is not related in any
manner to STRUTS. It's the way it works in the world of Java !
Jean-Pierre
-----Original Message-----
From: Pierre Métras [mailto:[EMAIL PROTECTED]]
Sent: mercredi, 1. novembre 2000 22:54
To: [EMAIL PROTECTED]
Subject: Can't obtain quote characters from struts message file
Hi,
I posted this problem one month ago but I've only found a strange solution.
Are other having such a behavior?
My tomcat+struts web application reads message tag strings from a property
file. In the default message file, that contains French sentences for the
moment, when the messages contains quotes ( ' ), these quotes disapear on
the HTML page. I traced the problem to the function reading the messages
from the property file.
For instance, "l'émission" is read as "lémission". I have tried to escape
the quote as in "l\'émission", according to the Properties class
documentation. I even run native2ascii on the property file and all
accentuated characters have been translated to Unicode escape, but the
problem still persist.
I created a test property file and stored it to disk, and the property are
really stored as the would do:
test=l'0u00E9mission
without any escape for the quote. When I read the property file from the
test program, I obtain the expected result. But that's not the behavior I
have in the web application...
As a last test, I tried to double the quote as in "l''émission" (that's two
quotes, and not a double-quote). And then it worked! I have "l'émission" on
the displayed HTML page.
Can someone explain this?
Pierre Métras