[fpc-devel] TField.AsString and Databases with UTF-8 charset
Martin Schreiber
fpmse at bluewin.ch
Wed Jul 22 06:57:40 CEST 2009
On Tuesday 21 July 2009 15:56:02 Graeme Geldenhuys wrote:
> What is your thoughts on this. As far as I know MSEgui does automatic
> trimming of spaces in the TField, so should this maybe be done in SqlDB
> (Interbase/Firebird) as well?
>
Don't confuse Firebird field datasize (in bytes) and field character length
(in characters/code points). MSEgui SqlDB fork queries the character length
by metadata. The utf-8 encoded database text will be converted to widestring
and stored in the dataset by variable length widestrings.
tmsestringfield.size will be set to the character length instead to the data
length.
Firebird trims CHAR fields for UTF8 to character length (byte length =
4*character length) and with the old UNICODE_FSS to byte length (=
3*character length), see
http://www.destructor.de/firebird/charsets.htm
Martin
More information about the fpc-devel
mailing list