<< Click to Display Table of Contents >> Navigation: Apollo VCL Components > Installing and Using Apollo VCL > DBF files: Mixing DOS and Windows access |
In this case, we need the Windows application to see the characters correctly by first 'translating' them. We also need to make sure that any writes to the data file will be done in with OEM characters so the DOS application will still work correctly. To do this, add a call to TApolloTable's OEMTranslate method immediately after opening an Apollo table. For example:
The following prepares Apollo to use OEM Collation based on the current Windows Locale.
procedure TForm1.OpenTables;
begin
// Prepare Apollo to use the machine collation
ApolloEngine.SetMachineCollation;
// Set OEMTranslate to True for each DOS table you
// want the new sort order to affect
ApolloTable1.OEMTranslate := True;
ApolloTable1.Open;
ApolloTable2.OEMTranslate := True;
ApolloTable2.Open;
End;
Delphi:
ApTbl.OEMTranslate := True;
ApTbl.Open;
// Application will correctly read and write this DOS OEM table
// Updates are transparent to the user.
C++Builder:
ApTbl->OEMTranslate := True;
ApTbl->Open();
// Application will correctly read and write this DOS OEM table
// Updates are transparent to the user.
Windows will display characters correctly, but the collating sequence will not be in ANSI, but rather in the original DOS order.
Delphi:
If the data was created in DOS originally, but will now only be used exclusively in Windows, see Convert OEM to ANSI. Next time the table is open, it will be a Windows table.
In summary, you need to choose between:
1) Keeping your data files in Windows-only (ANSI) form and having an ANSI sorting order.
OR
2) Keeping the ability to access your data files with normal looking characters in both Windows and DOS, but with sort orders in the original DOS sequence.
With Apollo, the sort order depends on the Windows setting which can be modified by calling ApolloEngine.SetMachineCollation or ApolloEngine.SetSystemCollation..
For German users, or others who also require support for Duden index collation support, this is provided by simply by calling: ApolloEngine.AddDudenCollation. This is a global (task-wide) setting and affects any tables opened after making this call, regardless of which TApolloTable object they may be attached to. In other words, you do not need to call this for each TApolloTable component within the application.
With Duden collation active, certain characters are expanded from their single-byte values into a double-byte value. The ASCII values of these characters differs between the ANSI and OEM character sets as follows:
Original Value |
Duden Value |
OEM Value |
ANSI Value |
Ä |
Ae |
142 |
196 |
ä |
Ae |
132 |
228 |
Ö |
Oe |
153 |
214 |
ö |
Oe |
148 |
246 |
Ü |
Ue |
154 |
220 |
ü |
Ue |
129 |
252 |
ß |
Ss |
225 |
223 |
For example, with Duden collation active, the value "Köln" would be positioned within the index keys as if the value were "Koeln".
See Also: OEMTranslate , Collation Support Summary