javalocalechinese-locale

Correct display of Currency TWD


I'm not native to Taiwan, nor do I have any knowledge of Taiwanese Mandarin. Hence it could be that all is as intended. My observation:

NumberFormat format = NumberFormat.getCurrencyInstance(Locale.TAIWAN); 
format.setCurrency(Currency.getInstance("TWD")); 

System.out.println(format.format(1600)); 

Results in $1,600.00. This might indicate to a reader the US Dollar, not the new Taiwan dollar (TWD). But TWD uses as symbol NT$, hence I would assume the correct result to be NT$ 1,600.00. Debugging indicates that the NumberFormat construction evaluates to a Symbol set in which $ is a default prefix - but before digging too much into details. Is this the intended behavior?


Solution

  • Seems to be intended. Based on the list of Currency symbols on Wikipedia, most of the different dollar currencies like Can$/C$ (Canadian dollar) or NT$/元/圓 (New Taiwan Dollar) (see third column of the table) still use simply $ as actual symbol (see first column of the table).

    There are some currencies where a letter + $ is actually the symbol, like the Nicaraguan córdoba for example with C$, for which the Java symbol and formatting is as expected with C$: try it online.