United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6573250 : Java.util.Currency.getSymbol(Locale) returns wrong value when locale is not US.

Details
Type:
Bug
Submit Date:
2007-06-25
Status:
Closed
Updated Date:
2012-12-20
Project Name:
JDK
Resolved Date:
2010-01-27
Component:
globalization
OS:
linux
Sub-Component:
locale-data
CPU:
x86
Priority:
P4
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:

Related Reports
Backport:
Backport:

Sub Tasks

Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)


ADDITIONAL OS VERSION INFORMATION :
Linux  2.6.21-1.3194.fc7

A DESCRIPTION OF THE PROBLEM :
If locale is the default locale, US, then the symbol "$" is returned.  However,
there are other locales that also have the "$" as their currency.  These locales
need to differentiate the American dollar using "US$".  Currently, "USD" is
returned.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
$
US$
ACTUAL -
$
USD

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
 Currency currency = Currency.getInstance(Locale.US);
 System.out.println(currency.getSymbol(Locale.US));
 System.out.println(currency.getSymbol(Locale.CANADA));
---------- END SOURCE ----------

                                    

Comments
EVALUATION

According to the CLDR there should be an entriy in the
j2se:src/share/classes/sun/util/resources/CurrencyNames_en_CA.properties
like this:
USD=US$

CLDR reference:
http://www.unicode.org/cldr/data/charts/by_type/names.currency.html
search for section "USD:symbol (English: $)"
                                     
2007-07-18
EVALUATION

Locale element problem, ###@###.### will take care of this.
                                     
2007-06-26
EVALUATION

There might be more such a different locales. This is subject to evaluate.
                                     
2007-06-26
WORK AROUND

From JDK 6, one could use java.util.spi.CurrencyNameProvider to provide localized currency symbol name for "USD" in CANADA locale, so that getSymbol(Locale.CANADA) would return "US$".
                                     
2007-06-25
EVALUATION

The reason why "USD" is returned in en_CA locale is that there is no localized currency symbol name for USD in the JDK's en_CA resource bundle.  Transferring this to the l10n team.
                                     
2007-06-25



Hardware and Software, Engineered to Work Together