Good day, all!
I'm using a TClientDataSet, connected to master-detail dataset. At first, save data (for futher data exchange)
cdsImpExp.SaveToFile(aFileName, dfXML);
In obtained file memo-fields are written in internal encoding (what encoding, BTW?): T_PATIENTS_MEMO="!?@02:0 4;O MB>9 " - for the master dataset
T_OBSERVATION_MEMO="!?@02:0 4;O MB>9 " - for the detail dataset
Now do
cdsImpExp.LoadFromFile(aFileName);
and try to process every field. I'm getting very strange behaviour for memo-fields content. At first I tried to read theese fields as:
FieldValue := Field.AsString;
In master dataset memo-field contains correct string in desired encoding (win-1251). In detail dataset memo-field contains the same char sequence as in input file (!?@02:0 4;O MB>9). Ok. I try this:
if Field.DataType = ftMemo then
begin
ms := TMemoryStream.Create;
TMemoField(Field).SaveToStream(ms);
ms.Position := 0;
SetString(FieldValue, PChar(ms.Memory), ms.Size);
And FieldValue contains some like 'Справка㐠㬄伄 этой㼠䀄㸄' (some chars are right and some chars are in Japaneese encoding).
What I do wrong? How can I read memo-field values from xml-file for the detail dataset? Thanks for your help.
I have Delphi XE Update 1.