[Lazarus] Zeoslib and string encoding

Santiago A. svaa at ciberpiula.net
Tue May 10 10:23:03 CEST 2016


I'm using Lazarus 1.6 svn: 5163, on Windows XP

I'm porting a small utility that connects to a Firebird database. The
utility uses Zeoslib and as Zeoslib has been ported to Lazarus it was
almost straight, but I have come across with a problem.

In some place it calls Field.size, but returns the double of the real
size of the field. I read that it could be related to character
encoding. It assumes that for utf-8 or utf-16 and it could need twice
bytes to store the same characters.

The question is that the database has as default character set win1252,
all the fields are win1252. The Zeos connection component has a property
"ClientCodePage" that allows values UTF8 and UNICODE_FSS, There is
another property "AutoencodeString" boolean. No combination works, I
always get double size.

I can't change the Database codepage, and it must run on a W-XP, so as a
quick workaround I just made the dirty hack of dividing by 2 the result
of field.size.

But now, I've read a thread in freepascal about encoding and I wonder
wether the problem is more related to freepascal 3.0 than to zeoslib. Is
there some compiler directive about string encoding I should be aware of?


Santiago A.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160510/888d6f0f/attachment-0002.html>

More information about the Lazarus mailing list