开发者

Pound sign from number format?

开发者 https://www.devze.com 2023-01-29 07:57 出处:网络
NumberFormat nf 开发者_Python百科= NumberFormat.getCurrencyInstance(Locale.UK); BigDecimal b = new BigDecimal(\"10\");
NumberFormat nf 开发者_Python百科= NumberFormat.getCurrencyInstance(Locale.UK);
BigDecimal b = new BigDecimal("10");
System.out.println (String.format("Data %s", nf.format(b.doubleValue())));

This outputs

Data ?10

How can I get the pound sign, for US if I change locale it outputs dollar sign.


The problem is with the encoding in which your response is rendered. Go through this great tutorial


Your sample-code prints a £ just fine in my test. But I use urxvt-unicode - a console able to print unicode-characters. I think your console isn't able to print the unicode-char. Try another console or another medium (for example web, with correct encoding set).

0

精彩评论

暂无评论...
验证码 换一张
取 消