java.util.Currency returns 中的 getSymbol() 不同值取决于 API 级别

getSymbol() in java.util.Currency returns different values depending on API level

以下代码用于以适当的货币格式化数字:

public static String getFormattedCurrency(String currencyCode, String currencyName, Number value) {

    //....

    NumberFormat format = NumberFormat.getCurrencyInstance(Locale.getDefault());                                           
    Currency currency = Currency.getInstance(currencyCode);                                                   
    format.setCurrency(currency);                                                                             
    if (format instanceof DecimalFormat) {                                                                    
        format.setMinimumFractionDigits(CURRENCY_MIN_FRACTION_DIGITS);                                        
    }                                                                                                         
    Log.d("Currency", "Symbol: " + currency.getSymbol() + ", Currency: " + currency + ", Locale: " + local);          
    return format.format(value);
}

currencyCode的价值是THB,泰铢。在 Lollipop 上,currency.getSymbol() returns ฿,泰铢的符号。然而,在奥利奥上,同样的方法 returns THB.

为什么这两个 API 级别之间返回不同的值?

基于this issue, it would appear to be a Unicode decision.