I looked at this again this morning: A simple Java-test fails and shows why:
Doing this: String va = "12 345,68 €"; NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.FRANCE); Number n = (Number) nf.parseObject(va); and you'll see that n is NULL. Why? So, here it is: the String va contains to blanks (" "), which are between 2 and 3, and between 8 and € as well. In fr_FR, however, the *grouping separator * is not " ", but it is a special char for blank (\u00a0). So, my little test will pass, when the first BLANK is replaced by the special char... I thought, that the NumberFormat actually does parse the object for me. Looks like (for fr_FR) I have to create a *custom parser*... Which is odd, IMO Now, do this: String va1 = "12 345,68 €"; NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.FRANCE); String va2 = nf.format(12345.68)); System.out.println(va1.equals(va2)); and you see, what the issue is... Anyway, anyone that has an idea on that one? Thx! Matthias On Nov 28, 2007 10:51 AM, Matthias Wessendorf <[EMAIL PROTECTED]> wrote: > for fixing Trinidad-202 ([1] (was done during incubation)), we added > these lines (and some other) > > DecimalFormat df = (DecimalFormat)fmt; > DecimalFormatSymbols dfs = df.getDecimalFormatSymbols(); > > if (dfs.getGroupingSeparator() == '\u00a0') > value = value.replace(' ', '\u00a0'); > > So far, so good. > But that causes issues, when running in "fr_FR" locale, like: > > <tr:inputText value="#{validate.currency}" > id="outputText1"> > <tr:convertNumber locale="fr_FR" type="currency"/> > </tr:inputText> > > The rendered output is "12 345,68 €", which is fine. > > When re-submitting this value, you'll see an converter-error-msg, that > the format is wrong. > That is because: > 1. the groupingSeparator() in fr_FR is '\u00a0' > 2. therefore the " " between 2 and 3 AND 8 and € is replaced by '\u00a0'. > > the later is the issue, and the conversion fails. > > Any ideas ? > > -Matthias > > [1] https://issues.apache.org/jira/browse/TRINIDAD-202 > > -- > Matthias Wessendorf > > further stuff: > blog: http://matthiaswessendorf.wordpress.com/ > sessions: http://www.slideshare.net/mwessendorf > mail: matzew-at-apache-dot-org > -- Matthias Wessendorf further stuff: blog: http://matthiaswessendorf.wordpress.com/ sessions: http://www.slideshare.net/mwessendorf mail: matzew-at-apache-dot-org