Number format and currency format are not always the same

Sorting it all Out
Michael Kaplan's random stuff of dubious value
Be sure to read the disclaimer here first!

Number format and currency format are not always the same

  • Comments 4

Almost a month ago I was talking about how GetCurrencyFormat and GetNumberFormat take strings for their number parameters and why. And John Bates commented:

One of my web forms (an invoice) has a column of currency amounts with a total at the bottom. The customer prefers to have the currency symbol only on the total.

So I should really be using GetCurrencyFormat for all the numbers, but have to use GetNumberFormat to get a string without the currency symbol.

So my question is: Does the number format for any locale differ from its currency format, with the exception of the symbol?

The answer to that question is that there are indeed locales where they are different, indeed that is the reason that all of the settings between the two are kept separate.

The PMs who work with customers and governments and subsidiaries know that the ramifications of adding an LCTYPE to GetLocaleInfo, especially one that will affect other functions and parsing/formatting rules in Windows or the .NET Framework, keep them from ever adding LCTYPEs without having proof that they are needed. It is in fact why sometimes the names do not seem 100% consistent (e.g. there is a LOCALE_SDECIMAL and then there is a LOCALE_SMONDECIMALSEP). The latter was added because it became clear that there are sometimes differences....

And this is an ever-evolving issue. For example, when all of the various percentage formats were added for the .NET Framework, a lot of the data was always identical to the numeric formats, so extra data fields were not added for them. But as data comes in that there are differences in some cases (as it has been), then the decision on what fields to add has to be made....

Sorry, John. You may want to find a better way to get the data....

 

This post brought to you by "㉧" (U+3267, a.k.a. CIRCLED HANGUL IEUNG)

Comment on the blather
Leave a Comment
  • Please add 5 and 2 and type the answer here:
  • Post
Blog - Comment List
  • > So my question is: Does
    > the number format for any locale
    > differ from its currency format,
    > with the exception of the symbol?

    Just download this one here:
    http://www.freemem.de/InfoExplorer.zip

    Not release quality software, not very beautiful, not code signed, but made for questions like this one. I built it while I was examining the whole international features of Windows.
    Should run from 95 to 2003 just fine.
  • That's what I thought.

    So GetCurrencyFormat really needs a new associated API to retrieve the CURRENCYFMT structure for a specified locale, with flags to turn off currency symbols, etc. GetNumberFormat and GetDateFormat may also benefit from similar functions.

    Are there any plans to add something similar to Longhorn? Can we also ask the owner of the GetXxxFormat functions to create a sample for MSDN that builds XxxFMT structures from the GetLocaleInfo results (especially for downlevel systems)?
  • Hi John --

    I can forward the suggestion on, it is a good one.

    On the whole, I am not sure it is worth adding flags to change behavior.

    If I were designing something here, I would probably not add a function at all -- I would add a flag to "fill in data not provided by the caller in the struct, from the locale."

    This would save people the trouble of having to call two functions....
  • So as Windows 8 was being developed, we had a huge review done of locale data.

    Quite a few bugs were

Page 1 of 1 (4 items)