Why doesn't FoldString take an LCID?

by Michael S. Kaplan, published on 2005/07/09 03:11 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2005/07/09/437071.aspx


I actually recall asking Julie Bennett this question (why doesn't FoldString take an LCID?) a few years ago, and her answer was that none of the foldings that the function did were locale-dependant.

Now that is true for some of the foldings:

Now it would be nice if MAP_FOLDDIGITS (Map all digits to Unicode characters 0 through 9) were a reversible opration. And the only way it ever could be would be to have an LCID parameter to specify what to map it to. Though as a workaround you could use the GetLocaleInfo function with the LCID you wanted to use and the LOCALE_SNATIVEDIGITS flag to map them. So this is not the end of the world.

However, that last flag, MAP_EXPAND_LIGATURES, is the tough one.

The flag as a simple job -- it expands all ligature characters so that they are represented by their two-character equivalent. Expand all ligature characters so that they are represented by their two-character equivalent. For example, the ligature 'æ' expands to the two characters 'a' and 'e'.

And this flag works by consulting the very same table that the collation functions use to find these characters that expand. Generally this will all work.

EXCEPT there are many languages (for example) where æ is considered to not be one of those characters to expand. This includes Danish, Norwegian, and Icelandic. And if FoldString took an LCID it could have at its disposal, the exact list for each circumstance might change as needed.

Unfortunately, there really is no good way to do this language-specific type of thing right now. Which means we may be expected to try and tackle the issue in some future release....

 

This post brought o you by "æ" (U+00e6, a.k.a. LATIN SMALL LETTER AE)


# Dean Harding on 10 Jul 2005 7:51 PM:

FoldStringEx?

It seems strange that while, to begin with, it might not have done any locale-dependant stuff, nobody had the foresight to see that it may in the future... especially since all the other NLS stuff did. Ah well, no use crying about it now :)

# Michael S. Kaplan on 10 Jul 2005 9:29 PM:

Well, thats what future versions are for, right? :-)

Anyway, there was already a function for the locale-specific ones -- LCMapString!

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/11/12 Suddenly, in a bit more time than a blink of an eye, "standards support" becomes "less i18n support"

2008/10/02 When swimming in a sea of CONTEXT, applications can drown (and there is no lifeguard)

2008/01/25 On reversing the irreversible (grabbing the data, part I)

2007/09/15 A&P of Sort Keys, part 5 (aka EXPANSIONing your horizons)

2007/05/05 All right, mistakes were made #1 (a.k.a. Expanding the EXPANSION table)

2007/02/14 Nothing seems to be parsing the crap out of *this* number

2006/06/18 The Phantom of the Digits

2006/04/26 How to NOT Parse Unicode Digits, or How to: Parse Unicode Digits... NOT!

2006/02/22 And the digits just keep on coming

2006/01/18 Digits -- there is no substitute

2005/07/19 Sort element vs. text element

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