5

I'm formatting some currency in Java. This piece outputs 9,99 €

    final NumberFormat nf = NumberFormat.getCurrencyInstance(new Locale("nl", "BE"));
    nf.setCurrency(EUR);
    nf.format(new BigDecimal("9.99"));

but one of our payment providers, which returns amounts preformatted, outputs € 9,99

Which is correct for nl-BE?

And more programming related, if it turns out the payment provider, and not Java, is correct, how do I fix the Java way without hacks per locale (in the real code the Dutch in Belgium locale is not hardcoded)

Charles
  • 50,943
  • 13
  • 104
  • 142
Bart van Heukelom
  • 43,244
  • 59
  • 186
  • 301
  • 3
    Belgium... Nobody agrees with each other. For this apparently also not. – BalusC Sep 27 '11 at 14:21
  • Yeah. Just find how it's done in the French-speaking side, and do the reverse for the Dutch-speaking side :-) - PS: this is coming from a French-speaking Belgian living in France – JB Nizet Sep 27 '11 at 14:42

2 Answers2

4

If Wikipedia is to be believed, neither is incorrect:

In Belgian Dutch, the euro sign can go before or after the amount, the latter being more common.

NPE
  • 486,780
  • 108
  • 951
  • 1,012
  • Thanks, though I just discovered my problem is bigger http://stackoverflow.com/questions/7571164/format-currency-in-a-language-regardless-of-country – Bart van Heukelom Sep 27 '11 at 14:51
  • 1
    Nowadays the wikipedia says "In Dutch language print, the euro sign (€) is chiefly placed before the amount, from which it is often separated by a (thin) space"... – eis Oct 27 '12 at 10:24
1

Short answer: Nobody cares. You can use anyone.

Somewhat longer answer: If the amount appears in a sentence, 9,99 € is more usual. If it's at the bottom of an invoice, both are used. No wait, you could even use EUR instead of €.

BTW, most people even expect 9.99 € instead of 9,99€ simply because locale data was invented 25 years late.

Be aware though that this is the opinion of a fr-BE guy ;-)

This is the kind of stuff where I believe locale info tries too much to differentiate neighbouring cultures. Think of keyboards: There is a layout for fr-FR and one for fr-BE. Letters, digits and most punctuation signs are at the same position but a few characters such as <, > or @ are at different position on the keyboard. WTF!

Serge Wautier
  • 21,494
  • 13
  • 69
  • 110