[fpc-devel] TField.AsString and Databases with UTF-8 charset

JoshyFun joshyfun at gmail.com
Fri Jul 24 17:07:58 CEST 2009


Hello Michael,

Friday, July 24, 2009, 3:31:32 PM, you wrote:

MVC> We need to foresee the possibility where the size in characters is
MVC> different from the size in bytes. If I am correct, the TWideStringField
MVC> accomodates for this, it uses a character size of 2.

Same problem with TWideStringField, unicode can be 32 bits...
TVeryWideString ? :)

But there are more problems (not tested recently) like:

Table with field NAME VARCHAR(5) UNICODE_FSS

Trying to write "abcdé" which is perfectly valid raises and exception
in SQLDB as it is 6 bytes in length.

If you write this field with other application (not FPC) the field is
accepted and at least in past versions SQLDB is unable to read it, or
returns a malformed UTF8 String "abcd?".

Since that problems I'm using Firebird in SQLDB with UTF8 data over
regular (VAR)CHAR fields without the UNICODE_FSS. I can not perform
uppercase and like selects but at least works in a predictable way.

-- 
Best regards,
 JoshyFun




More information about the fpc-devel mailing list