Subject Re: [firebird-support] Bug with character sets
Author Ann W. Harrison
Martijn,
>
> Then what does it transfer? The server know how many characters
> there are, doesn't it?

Yes.

>
> How does this work for VARCHAR?

A VARCHAR is passed as two bytes of character length, plus
that many characters. So the actual stored character length
is passed for a VARCHAR. The buffer is fixed size and
probably padded with spaces.
>
> Why is the CHAR buffer padded, but it seems VARCHAR isn't?

Both are padded. VARCHAR has the character length. CHAR
does not. Perhaps the easiest solution is to cast all strings
to VARCHAR if you're using a multi-byte (and especially a
variable length multi-byte) character set.


Cheers,

Ann