Re: JDK currency formatting bugs fixed in ICU?

Doug Felt <[email protected]>
Newsgroups gmane.comp.lib.icu.general
Message-ID <[email protected]>
Elsebeth:

I haven't yet seen the testcase for the sun bug.  When I try to reproduce the
bug from the description, using a standard currency instance for de_DE, I see
no error with either Sun JDK 1.4.1 number format or ICU4J number format.  

I can force an error by calling NumberFormat.setParseIntegerOnly(true), this
will fail when parsing a full decimal currency ("12.345,00 \u20ac") but will
succeed with ("12.345 \u20ac").

Without seeing the test case I can't be sure, but if this is the scenario, then
I believe it to be user error.  If setParseIntegerOnly is true, then it should
fail to parse if it encounters a currency with decimals.  It happens to succeed
with US currency as the decimal, if present, terminates a complete match to the
pattern, but it fails with german euros.  I don't see any comments from Sun
indicating how they intend setParseIntegerOnly to behave, but I don't think
they would contradict me.  I believe the intent is to make the parser more
restrictive, and _not_ to make it simply ignore a successful match of the
decimal portion of a currency, when present.

I do believe it is unfortunate, and perhaps wrong, that a parse of $12,345.00
succeeds while a parse of 12.345,00 \u20ac fails, but I would consider the
'error', if any, to be that the former parse succeeds.  But setParseIntegerOnly
is a simple switch and not a sophisticated filtering mechanism on the pattern,
so it's probably inappropriate for it to do this.

Bottom line is, this should be better documented, and the correct behavior more
thoroughly specified.

I'll take this up with Sun.

Doug





--- Elsebeth Flarup <[email protected]> wrote:
> 
> 
> 
> 
> I am trying to verify whether the current version of ICU contains fixes for
> 2 bugs still listed as 'In progress' in the Sun bug database: bug ID
> 4738167 (Indian currency format pattern does not recognize the Indian
> grouping of monetary formats into formats like this: 12,34,56,789). I think
> this is fixed in ICU (bug report #417 is listed as Closed)?
> 
> The other item is Sun bug ID 4709840 - failure to parse integer portion of
> currency formatted using locales that position the currency symbol after
> the numeric part of the string.
> I haven't been able to find a reference to this in the ICU bug DB.
> Thanks,
> Elsebeth
> 
> CRM Globalization Architect
> Phone: 919 850 6996; T/L: 436 6996
> Fax: 919 850 7720
> E-mail: [email protected]
> 
> 
> _______________________________________________
> icu mailing list
> [email protected]
> http://oss.software.ibm.com/developerworks/oss/mailman/listinfo/icu


__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.