SetCollation issue

This forum is meant for questions about the Visual FoxPro Language support in X#.

g.bunzel@domonet.de
Posts: 97
Joined: Tue Mar 01, 2016 11:50 am
Location: Germany

SetCollation issue

Post by g.bunzel@domonet.de »

...just an info out of the ADS-helpfile:
Note Collation languages are only valid with ADT and VFP tables. For all other table types, the collation language is ignored.


I use these settings since a long time and never had a problem also with mixed applications (Windows and DOS):

SetNatDLL("GERMAN.DLL")
SetAnsi( TRUE ) // after SetNatDLL()
SetExclusive( FALSE )
SetDeleted( TRUE )
SetCentury( TRUE )
SetCollation( #CLIPPER ) // after SetANSI()
SetInternational ( #CLIPPER )



AX_SetCollation( strCollation AS STRING )

Parameters
<strCollation>
Collation language for the RDD to use.

Returns
The previous collation setting.

Description
This function specifies which collation language to use when opening tables, opening cursors, or creating tables. By default, no collation language is set and the client will use the language set by the Advantage Database Server.

Note Collation languages are only valid with ADT and VFP tables. For all other table types, the collation language is ignored.

regards
Gerhard
ic2
Posts: 1863
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

SetCollation issue

Post by ic2 »

Thanks for all the reactions.

What makes it even more strange is that I read that ADS overrides the codepage settings, and both my system and the server of the client use ADS with the same settings (Configuration/Language: ANSI character set is empty and OEM character set is USA).
@Karl-Heinz: The reason I don't reindex on the server: my program allows to select the regular databases to index and when this is all done, it auto-reindexes the language dbf. So the same effect is achieved when I copy my ADS created dbf+cdx to the ADS environments of clients. And on this server (and others) previous versions have been correct and the other way around.

One thing I still don't understand. Suppose the setcollation is the cause, as reindexing in dbMax with Clipper seems to solve it. I always though the collation determines the order in which the records appear with Skip(). Not that I simply can't find a non ANSI string like FX_VERZENDEN.

Hence I am a bit reluctant to change my program's collation to #Clipper as this may cause issues elsewhere.

I update this database max 10 x a year for max 10 clients from which only a few have had this issue. So if after copying I reindex with dbMax I can probably prevent the problem. But I mainly want to understand why it happens.

@Robert: I will try the GetUserDefaultLCID later and report back.

Dick
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SetCollation issue

Post by robert »

ic2 wrote:Thanks for all the reactions.
@Robert: I will try the GetUserDefaultLCID later and report back.
IMHO this was the most important thing to check...

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
ic2
Posts: 1863
Joined: Sun Feb 28, 2016 11:30 pm
Location: Holland

SetCollation issue

Post by ic2 »

Hello Robert,

I am a bit confused. On my Pc this GetUserDefaultLCID() function returns 1043. On the system of my client (all Remote Desktop so no separate client or server) it's 1033. I assume that's something different than the codepage?

So yes, they are different but I am sure nothing changed on that system and most earlier seeks in the same dbf worked earlier (most of the times0. And still the VO docs talk about compare results, not about not finding a keyvalue at all.

Should I set it in my program to 1043 with SetAppLocaleid? Or something else?

Dick
User avatar
robert
Posts: 4558
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SetCollation issue

Post by robert »

Dick,
1043 = Dutch - Netherlands
1033 = English US
There are not the codepage but these defines the sorting rules for the characters in the codepage. Both locales work with codepage 1252.
The sorting rules are used to determine the order of the keys in an index and also when seeking.Seeking a value in an index also uses these tables.
I can't say if you should use 1043 or 1033. That depends on how you want to sort. If you want to see the difference, I recommend to create a test file with character fields with values 1-255 and then create an index and list the records. You can also fill an array with strings from chr(1) until chr(255) and asort them with both locales and compare the results.
You can then see the difference and decide which sort order is best for you. Most likely there will be a difference w.r.t. accented characters and probably some special characters, such as the Euro sign.
If you use a completely different locale,for example the German then the ß is sorted as "ss" And for example in the Spanish locale the CH and LL will be sorted a single litters.

The following page gives an overview over various language codes.
https://www.science.co.il/language/Locale-codes.php
And this page explains some of the rules for various languages.
https://en.wikipedia.org/wiki/Alphabetical_order

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply