Some currencies missing from the Java currency API

I write currency conversion code in Java and using this API to create an internal currency lookup table

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 */ } 

So far I have two observations.

Many international currencies have signs in Latin script and native script. Java seems to be inconsistent with what it returns. Am I using a restriction or am I using the API incorrectly?

Thanks!

+5
source share
1 answer

I checked your code for the Indian rupee sign and it seems to work fine. The character is available for the hi_IN locale hi_IN

rupee symbol for hi_IN locale

But en_IN available symbol "Rs"

R character for en_IN locale

Make sure you use the correct language. :)

+6
source

Source: https://habr.com/ru/post/1265254/


All Articles