Fix for currency symbol coming from the default locale
NumberFormat.setCurrency() (actually DecimalFormat) was using
currency.getSymbol() without passing the format's locale. This
caused the default Locale to be used to look up the symbol.
The fix uses the format locale, not the default. A test has
been added to demonstrate the problem / fix.
To avoid having the NativeDecimalFormat know about the locale class,
the symbol is passed as an argument rather than the Currency object.
This is an internal API.
Making this change showed an issue with Currency.getSymbol():
For Locales without a country the currency code would be returned
and not a symbol.
ICU provides language-level symbols so this was not the best
we could do. Since the code was previously using the default
Locale, and the default locale usually has a country it was
not previously obvious.
testBug71369 broke because of this second issue. The code is also
fixed here.
This was discovered while investigating bug 71369 but is not
related.
Change-Id: If0ce280aefb042fe8f7ca126cced090b9268a866
4 files changed