1

I got an accounting software that use dBase III database directly. I also got an home made software written in Delphi XE2 that use these database. Delphi use Sybase Advantage server V11 to communicate with the database. If i write a "é" in the account software, when i read it with the Advantage server, I read a ",".

The account software company seem to think that it was written with IBM codepage 850 but if I use ICLAND850 in Advantage server, i does not work.

After trying many different codepage in ADS, I dont seem to be able to find the right one.

I change the code page in the advantage server but do I have to change it elsewhere?

Is there a way or a software to detect the caracter set in DBF?

Charles
  • 50,943
  • 13
  • 104
  • 142
Carl
  • 23
  • 3

1 Answers1

3

You have to set the AdsTableOptions.AdsCharType in your TAdsQuery and TAdsTable components:

http://devzone.advantagedatabase.com/dz/webhelp/Advantage11/ade_adschartype.htm

The dynamic collations are only support for VFP-Tables so for the old DBF files you are dealing with you have to set this to either ANSI or OEM.

Depending on what kind of connection you are using (ALS or Remote server) the way to set up the correct ANSI/OEM codepage is different.

See also my answer to this question: Advantage Database Index Collation Sequence

It's possible to get the raw bytes used in the data using TField.AsBytes. I would read the raw bytes from an example row and field that contains characters outside of ASCII and look them up in OEM/ANSI tables to find out the correct code page.

There are OEM and ANSI tables available on the web.

For example the é character (which is Unicode $00E9) is $82 in OEM 850:

http://demo.icu-project.org/icu-bin/convexp?conv=ibm-850_P100-1995&s=ALL

Community
  • 1
  • 1
Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
  • 1
    Thanks for you answers. Now, when i try Query.Fields(1).asbyte, i got (0,0,0,0,0,0,0,0,0) but if i do Query.Fields(1).asString i got ('c......'). Any idea? – Carl Oct 16 '13 at 15:46
  • @Carl You're right, `AsBytes` doesn't work for this, I just tried it myself. You can always open the .dbf file with a hex editor that way you know exactly how the char is stored. – Jens Mühlenhoff Oct 16 '13 at 18:17
  • Maybe this question can help as well: http://stackoverflow.com/questions/6756124/detect-the-encoding-from-a-dbf – Jens Mühlenhoff Oct 16 '13 at 18:19
  • 2
    I finally found the problem. In advantage data architect, When i add the table in the data dictionary, i use ANSI for collation. i cannot open the table i OEM even if in Advanced opening, i can change the collation for OEM. When i delete every table in the dictionary and add them again but this time, in OEM, everything work fine. Thanks for your help, it help me to find the real problem. – Carl Oct 17 '13 at 01:23
  • Thanks for letting us know what the real problem was. You should have written that you are using a dictionary in the question though, I assumed you were using free tables. – Jens Mühlenhoff Oct 17 '13 at 10:08
  • My mistake, i forgot to mention it because i never tought it was the problem. I will know the next time i ask question to write all the tool i use. Thanks again. – Carl Oct 17 '13 at 12:39