Cyrillic problem with DBASE III and Delphi XE2

How Can I Read Cyrillic text from Old DBF file. Get the code page on the text.Encoding to Unicode then
write into DBF file with the same code page as the original ?

Thanks in advance.
VIKTOR PEEVAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
I suspect that this wouldn't work. Old dbf use a single byte char String  - but very newest Delphi use two-bzte char Strings. I assume that you need make some transform functions for reading/writing (same dbf?)
0
VIKTOR PEEVAuthor Commented:
I understand that and Looking  Help for transformation ??
0
Sinisa VukSoftware architectCommented:
I need more details. Version of Delphi, which component you user to access dbf, do you want to read and write to same dbf,...?
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

VIKTOR PEEVAuthor Commented:
I use Delphi XE2 and TDBF table .Read data from DBF . / Edit or Insert / In the same or similar DBF .
0
Sinisa VukSoftware architectCommented:
This is good. Xe2 can work in both ways using String (2xbyte chars) and AnsiString (1xbyte char). If  TDBFtable is compatible to this... you probably do not need to modify anything - if codepage of win is compatible with dbf. Try it and check results.
0
Geert GOracle dbaCommented:
DBASE III ?

i'd try to write it to a different table first, preferably with unicode support
set your os to  the cyrillic codepage 1251

you'll need a font too, which is capable of displaying the cyrillic characters

read the data
and then write it another database.

reading and writing it to the same dbase III might not work in every scenario

how the data is translated also depends on the settings of the database client you use
0
Geert GOracle dbaCommented:
from what i know
you typically read such data into an AnsiString with a certain codepage.

type
  TCyrString = AnsiString(1251);

yourstring: TCyrString;

yourstring := qry.FieldByName('FIELD').AsAnsiString;

Open in new window


and then copy that to a unicode string

str: string;
str := yourstring;

Open in new window

0
VIKTOR PEEVAuthor Commented:
Thanks for answer. I already try this approach but the problem is that
the DBF is from old DOS program that use some different code page.
I try with AnsiString(1251) , AnsiString(866) , AnsiString(855)  but not work.
Attach the DBF file.
I write a program on Delphi XE2 that work with a firebird and I need to / export or insert /
some cyrillic data to this old DBF with a same code page as a original
that can be read on old DOS program ?
test.ZIP
0
VIKTOR PEEVAuthor Commented:
Ok DBF use ASCII code
I convert my Text from Unicode to AnsiString(1251) then to Ascii
type
 CyrillicString = type AnsiString(1251);

procedure Conv_Ansi_ASCII(var S:CyrillicString) ; {ANSI -> ASCII}
var
 i:Integer;
begin
 for i:=1 to Length(s) do
   if Ord(S[i]) in [192..239] then S[i] := AnsiChar(Ord(S[i])-64) else
   if Ord(S[i]) in [240..255] then S[i] := AnsiChar(Ord(S[i])-16) else
   if Ord(S[i]) = 168 then S[i] := AnsiChar(Ord(240)) else
   if Ord(S[i]) = 184 then S[i] := AnsiChar(Ord(241));
end; 

Open in new window


Problem is when I Insert text to DATABASE true TDBF in Delhi XE 2 text goes wrong ??
if I save the text to text file and Insert it true TDBF in Delphi 7 everything is OK ?

??????

Thanks.
0
VIKTOR PEEVAuthor Commented:
Thanks to Geert Gruwez and Sinisa Vuk for a Help. I found solution without converting to ASCII. Simply use ADO with File DSN to connect DBF
File DSN is DBASE III and ASCII Collating Sequence ;
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VIKTOR PEEVAuthor Commented:
Its work for me
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.