myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthias Weßendorf (JIRA) <...@myfaces.apache.org>
Subject [jira] Created: (TRINIDAD-849) NumberConverter (type:currency; locale:fr_FR) does not work
Date Mon, 03 Dec 2007 15:34:43 GMT
NumberConverter (type:currency; locale:fr_FR) does not work
-----------------------------------------------------------

                 Key: TRINIDAD-849
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-849
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.2.3-core, 1.2.2-core, 1.2.1-core, 1.0.4-core, 1.0.3-core, 1.0.2-core,
1.0.1-core, 1.0.5-core, 1.2.4-core
            Reporter: Matthias Weßendorf
            Assignee: Matthias Weßendorf


The source of this problem is a JDK bug (tested against SUN), where the NumberFormat has some
problems

See here for the Sun JDK:
http://bugs.sun.com/view_bug.do?bug_id=6318800

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
nb space (\u00a0).

So, my little test will pass, when the first BLANK (only) is replaced by the
non-braking space...
(in that case, the String would look like: "12\u00a0345,68 €";)

I thought, that the NumberFormat actually does parse the object for me.
Looks like (for fr_FR) I have to create a *custom parser*...


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message