The city elders won't give this string weight, either (aka On being consistently dead wrong, aka Ordinal or bust?)

by Michael S. Kaplan, published on 2006/12/26 12:40 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/12/26/1365492.aspx


The question Richard Wilson asked me via the contact link:

I am having problems with string comparisons with the Unicode Greek Extended characters, and someone suggested writing to you. The thread is

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1049188&SiteID=1

but basically any comparison between two Greek Extended characters says they are equal, and any comparison between a normal and Extended character says that the Extended character comes first. (Excluding of course an Ordinal comparison, which doesn't help me because the ordinal order for Greek extended characters is not the alphabetical order). This is true for all the types of string comparisons in .NET, and someone has said that there is the same problem with the API call CompareString()

Is this an error in Windows, or is there a way to correctly compare and sort Greek characters with accents? Thanks in advance.

Well, somewhere between the title of this post and the one it alludes to (this one), the answer lies.

These characters have no weight in collation, in either Windows or the .NET Framework, until Vista.

Though as a bonus in managed code, if you are running on Vista, any of the 72 Windows-only cultures that are synthesized from new locales in Vista will also give those characters weight....

Short of that, it's ordinal or bust.

As a postscript, this does not change in Orcas, given the whole red bits/green bits mess I have ranted about before. The powers that be are convinced that all customers prefer results that are consistent with prior versions even if that means being consistently dead wrong (if you disagree then I won't disagree with you!).

 

This post brought to you by  (U+1f00, a.k.a. GREEK SMALL LETTER ALPHA WITH PSILI)


# Dean Harding on 26 Dec 2006 5:59 PM:

I thought the red/green bits thing only affected the .NET framework v3 (aka WinFX) while Orcas is more like .NET v4? Or is Orcas just a new Visual Studio on top of .NET v3?

It's so confusing!!

And if Windows can update its collation tables, why can't the .NET framework? I would have expected that they'd use the same data, actually...

Ah well, not that there's much you or I could do about it, unfortunately!

# Michael S. Kaplan on 26 Dec 2006 8:10 PM:

Welcome to my world, Dean!


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

2006/12/27 If you decompose those city elders, you might be able to sort them out!

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