[fpc-devel] String and UnicodeString and UTF8Stringt
LacaK
lacak at zoznam.sk
Wed Jan 12 09:45:47 CET 2011
Sven Barth wrote / napĂsal(a):
> Am 12.01.2011 07:16, schrieb LacaK:
>> P.S. I still does not understand, how can things work correctly if LCL
>> expect that all AnsiStrings (String) are UTF8Strings, byt RTL/FCL does
>> not strictly follow this (at least in Windows) ?
>
> LCL uses SysToUTF8 and UTF8ToSys if it uses the RTL (and the FCL).
> This is often done with wrappers that wrap the RTL method and do the
> conversion (e.g. FileExistsUTF8, etc.).
As I wrote in any of my previous message, AFAIK this is not true in case
of "fcl-db" and Lazarus data-aware components like TDBGrid, TDBEdit ...
They use "TField.Text: String" property to get string conent of field
and display them.
AFAIU LCL expects, that TField.Text will always return UTF-8 encoded
string (because no conversion (SysToUTF8) is done in dbgrids.pas or
dbedit.inc) , but this is not true always.
So where is error ?
1. Is it wrong expectation by LCL, that TField.Text is always UTF8 string
-or-
2. Is it wrong in implementation of TSQLConnectors, which write data
into record buffer (of TStringField) and do not convert them always into
UTF-8 ?
(if data should be always in UTF-8 then it will be good redefine
TField.Text property like "property Text: UTF8String" to be clear, that
we always work with UTF-8 strings)
-or
3. I missed something ? ;-)
-Laco.
More information about the fpc-devel
mailing list