Subject | Re: [firebird-support] Bug with character sets |
---|---|
Author | Ann W. Harrison |
Post date | 2009-05-19T22:14:56Z |
Kjell
area reserved for precision of numbers. Milan's message said:
select 'Y' from rdb$database;
returned buffer: 'Y ';
returned length: 4
returned charset ID: 4 (UTF8)
select RDB$BYTES_PER_CHARACTER
from RDB$CHARACTER_SETS
where RDB$CHARACTER_SET_ID = 4;
real length in characters = 4/4 = 1
truncate the result to 1 character to get 'Y'
In FlameRobin we read in all the character set lengths
when connecting to the database, and later just reuse that info.
That procedure will, I think, preserve stored trailing spaces
in CHAR fields - whether that's good or not is an open question.
Good luck,
Ann
>>>That's passed in the sqlda, probably (from feeble memory) in the
>>> 1. What does Milan's code know that fbclient doesn't?
>> Length of string in characters.
>
> I understand that Milan derives that from 1) buffer size and 2) max
> number of bytes per character for the encoding used. The latter is
> deduced from a charset id. Where does he get that charset id?
area reserved for precision of numbers. Milan's message said:
select 'Y' from rdb$database;
returned buffer: 'Y ';
returned length: 4
returned charset ID: 4 (UTF8)
select RDB$BYTES_PER_CHARACTER
from RDB$CHARACTER_SETS
where RDB$CHARACTER_SET_ID = 4;
real length in characters = 4/4 = 1
truncate the result to 1 character to get 'Y'
In FlameRobin we read in all the character set lengths
when connecting to the database, and later just reuse that info.
That procedure will, I think, preserve stored trailing spaces
in CHAR fields - whether that's good or not is an open question.
Good luck,
Ann