[fpc-devel] String and UnicodeString and UTF8Stringt

Martin Schreiber mse00000 at gmail.com
Wed Jan 12 11:22:33 CET 2011


On Wednesday, 12. January 2011 09.45:47 LacaK wrote:
>
> 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 ? ;-)
>
MSEgui sqldb version converts to UTF-16 from/to system encoding or utf-8 
(selectable by option properties) and uses FPC 16bit UnicodeString to store 
string field values in the dataset, the tmsestringfield returns UnicodeString 
values. So one can either use utf-8 encoded databaseconnections or 
connections with the current system encoding.
MSEgui uses 16 bit UnicodeString everywhere, the conversion from/to system 
encoding is done transparently by the FPC unicode/widestring-manager if 
necessary.
This is a solution which works now, no additional complicated and possibly 
less performant codepage and encoding aware stringtype necessary...

Martin



More information about the fpc-devel mailing list