JDK-6573250 : Java.util.Currency.getSymbol(Locale) returns wrong value when locale is not US.
  • Type: Bug
  • Component: globalization
  • Sub-Component: locale-data
  • Affected Version: 6
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2007-06-25
  • Updated: 2012-12-20
  • Resolved: 2010-01-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7 Other
6u10Fixed 7 b80Fixed OpenJDK6Fixed
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: $)"
18-07-2007

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

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

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$".
25-06-2007

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.
25-06-2007