I'm writing some currency conversion code in Java and and using this API to build up an internal lookup table of currencies
final Locale[] locales = Locale.getAvailableLocales();
for (final Locale locale : locales) {
final Currency currency = Currency.getInstance(locale);
String sign = currency.getSymbol(locale)
String code = currency.getCurrencyCode()
/* do something with them */
}
I've two observations so far.
This listing does not return a Rupee sign in the native script https://en.wikipedia.org/wiki/Indian_rupee_sign. It returns Rs. instead
Similarly for the Russian Ruble, it returns руб instead of the Ruble sign in the native script https://en.wikipedia.org/wiki/Ruble_sign
Many international currencies have signs in the Latin script and native script. Java doesn't seem to be consistent in what it returns. Am I running into a limitation or is my API usage incorrect?
Thanks!
I tested your code for Indian Rupee sign, and it seems to be working perfectly.
The symbol is available for locale hi_IN
But for en_IN
, 'Rs' symbol is available
Make sure you use right locale. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With