views:

40

answers:

2

This may be a niche question but I'm working with ICU to format currency strings. I've bumped into a situation that I don't quite understand.

When using the MesssageFormat class, is it possible to get access to the NumberFormat object it uses to format currency strings. When you create a NumberFormat instance yourself, you can specify attributes like precision and rounding used when creating currency strings.

I have an issue where for the South Korean locale ("ko_KR"), the MessageFormat class seems to create currency strings w/ rounding (100.50 -> ₩100).

In areas where I use NumberFormat directly, I set setMaximumFractionDigits and setMinimumFractionDigits to 2 but I can't seem to set this in the MessageFormat.

Any ideas?

A: 

Probably because one Korean Won is worth $0.00088. They don't have pennies.

Same idea with the Swiss Franc, the 1 centime coin stopped being legal tender in 2007.

Hans Passant
Possbily. Though as I mentioned, regardless of real world value, if the currency locale isn't defined to have a rounding (the Swiss Franc is but the Korean Won is not), then I don't expect it to round.
Travis
A: 

I've determined that gaining access to the internal formatter used is not possible. I've opened a ticket with the ICU project. http://bugs.icu-project.org/trac/ticket/7571#preview

Travis
-1, this is *not* an answer.
Hans Passant
It is an answer it's just not a solution. It's meant to be guidance for those landing on this page via a google search for this issue.
Travis