|Subject||Re: [firebird-support] Three trailing spaces?|
On 12-12-2014 15:38, Tim Ward tdw@... [firebird-support] wrote:
> On 12/12/2014 14:15, Mark Rotteveel mark@...
> [firebird-support] wrote:
>> What is the default character set of your database (if I had to guess it
>> is UTF8), and what is your connection character set (if I had to guess
>> NONE or not specified)?
> Database charset is UTF8. Connection charset appears also to be UTF8.
If the connection character set is UTF8 (this needs to be specified
explicitly!) then it looks like the driver is misbehaving.
The call is
ibase_connect(TSL_DATABASE, TSL_FB_USERNAME, TSL_FB_PASSWORD, TSL_FB_CHARSET, TSL_FB_BUFFERS, TSL_FB_DIALECT);
define('TSL_FB_CHARSET', 'UTF8'); //NB: no dash, not 'UTF-8'
The 'problem' is that a CHAR(1) in UTF8 is sent as 4 bytes. If the
character in question is a one-byte UTF8 character, then the remaining
three bytes are 0x20 (a space). A driver should truncate the string to
the declared number of characters, but doesn't do that here.
A potential workaround might be to use VARCHAR(1) instead.
-- Tim Ward