Hey brother, can you spare a Euro?

by Michael S. Kaplan, published on 2005/09/09 02:45 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/09/08/462776.aspx

Recently overheard in the newsgroups:

Okay, I've had enough of trying to figure this out so it's time to ask those who know. What I'm trying to do is quite straightforward but seems to be a nightmare to get right.

I have a system that needs to format a monetary value based on the associated monetary symbol. i.e. It needs to format a GBP value to 2 decimal places, EGP to 3 decimal places etc.

I can query the Locale Info to get the number of decimal places for these locales which is fine but the last time I went to Spain they were using the Euro, not the Pesata. France wasn't using the  Franc anymore. When I enumerate the available locales, I never get an entry that says it's using the Euro. Therefore my Spanish values format to 0 decimal places and my French format to 2 decimal places.

As far as I know, I do have the latest version of the OS. Win2k with all the service packs and Windows Updates. How can I check what's not up to date?

Can someone point me in the right direction please.

Thanks in advance.

The problem is easy enough, it is that locale data is not really updated on Windows in service packs; it is generally only done in major releases. To that end, both Windows XP and Windows Server 2003 have full support for the Euro in the appropriate "Euro zone" countries. But for earlier versions of Windows, there is no way to pick up support for all of those locales.

Now there is a tool that Microsoft released on Windows Update that will update the appropriate Regional Options settings for downlevel verions of Windows if your user locale is in one of those Euro zone countries. And the tool is left on the machine so it can be rerun as needed or other users or after later changes are made in Regional Options. But to get that support for all of the Euro locales, you have to have the up-to-date OS....


This post brought to you by "€" (U+20ac, a.k.a. EURO SIGN)


# Mihai on 9 Sep 2005 2:00 PM:

Or you can cheat a bit, get the system locale settings, then force the currency to what you need (if you know this is really what you need).
And here is some code:

# Mihai on 9 Sep 2005 5:02 PM:

Correction "get the system locale settings" should be "get the user locale settings" (obvious).

# juan on 13 Sep 2005 5:47 PM:

Only one tic.

It´s "peseta" and NOT "pesata".


Please consider a donation to keep this archive running, maintained and free of advertising.
Donate €20 or more to receive an offline copy of the whole archive including all images.

referenced by

2010/03/18 Whether the currency sign is right or wrong could be something of a crapshoot

go to newer or older post, or back to index or month or day