You are not logged in.
hi,ad
I use synoledb, when SQL include some Asian languages(Double-byte characters),then SQLW is Wrong. zeos,sqlite3,firedac has same problem.
-----> in synoledb.pas line 1480
procedure TOleDBStatement.Prepare(const aSQL: RawUTF8;
ExpectResults: Boolean);
begin
...
SetLength(SQLW,L*2+1);
UTF8ToWideChar(pointer(SQLW),pointer(fSQL),L); ----------------- this!
fCommand.SetCommandText(DBGUID_DEFAULT,pointer(SQLW));
end
when fSQL include some Asian languages(Double-byte characters),then SQLW is Wrong.
eg:
fSQL ='select 'changyu畅雨' as name '
but Converted to SQLW ='select 'chan '
-------> symCommons line 9432
function UTF8ToWideChar(dest: pWideChar; source: PUTF8Char; sourceBytes: PtrInt=0): PtrInt;
begin
...
c := pCardinal(source)^;
if (c and $80808080<>0)then -------------not support some Asian languages(Double-byte characters)
break; // break on first non ASCII quad
...
end
Offline
Problem solved, before Execute(SQL,[]) just AnsiToUtf8() :Execute(AnsiToUtf8(SQL),[])
Offline
Yes, as stated by the documentation, everywhere in mORMOt classes (including SynDB units), you have to use RawUTF8 kind of string, not plain AnsiString.
so you have to use AnsiToUtf8() if your text is AnsiString.
or even better, StringToUTF8() which is Unicode-ready, so will work with any version of Delphi.
Offline
thanks mORMot Framework is great!
Offline