You are not logged in.
Pages: 1
Hello,
In database we have test company with Serbian Latin and Cyrillic letters "Test Company ŠČĆ ШЛЧ".
When I try to move data received from Database into TDataSet, Serbian Latin and Cyrillic letters changed.
Here is code.
fTableJSON := FormDataModule.Service.GetCompanyList(FormDataModule.User.CompanyID); //"Test Company ŠČĆ ШЛЧ" ' It is OK!
fDataSet := JSONToDataSet(self, fTableJSON);
unit mORMot
constructor TSQLTableJSON.Create(const Tables: array of TClass; const aSQL,
aJSON: RawUTF8);
var len: integer;
begin
len := length(aJSON);
PrivateCopyChanged(pointer(aJSON),len); //"Test Company ŠČĆ ШЛЧ" ' Until here is OK!
Create(Tables,aSQL,pointer(fPrivateCopy),len);
end;
constructor TSQLTableJSON.Create(const Tables: array of TClass; //Here JSONBuffer is "Test Company ŠČĆ ШЛЧ"
const aSQL: RawUTF8; JSONBuffer: PUTF8Char; JSONBufferLen: integer);
begin // don't raise exception on error parsing
inherited Create(Tables,aSQL);
ParseAndConvert(JSONBuffer,JSONBufferLen);
end;
How can I avoid this problem?
Offline
Which version of Delphi are you using?
Are you sure your JSON content is UTF-8 encoded, as expected by the framework?
Read the "Unicode and UTF-8" paragraph in the "SynCommons unit" chapter of the SAD pdf - in revision 1.18.
Offline
Delphi XE3.
For my case, I found working around solution. Instead TDataSet I used TSQLTableJSON and everything is working fine.
On server side I put data from SQLServer into RawJSON, and on Client side receive data into RawUTF8. This part shows data correctly. Now if I RawUTF8 data move to:
1. TSQLTableJSON and fill ComboBox with it, everything is OK, but if I put data into
2. TDataSet and fill ComboBox with it, for each Cyrillic letters I'll get sign "?".
TSQLTableJSON filled: fData := TSQLTableJSON.Create([], '', fTableJSON);
TDataSet filled: fDataSet := JSONToDataSet(self, fTableJSON);
var declaration is:
var
fTableJSON: RawUTF8;
fData: TSQLTableJSON;
fDataSet: TDataSet;
How I sow, problem is on second constructor and Pointer: "JSONBuffer: PUTF8Char"
Offline
Pages: 1