Subject | Re: [firebird-support] Bug with character sets |
---|---|
Author | Vlad Khorsun |
Post date | 2009-05-20T07:10:39Z |
>>>1. What does Milan's code know that fbclient doesn't?For CHAR(N) fileds string length in characters is always N, for VARCHAR(N)
>>
>> Length of string in characters.
string length stored in first two bytes of buffer.
> I understand that Milan derives that from 1) buffer size and 2) maxOpposite. Bytes_per_char is required to allocate buffer for XSQLVAR's
> number of bytes per character for the encoding used.
and used *before* obtaining query results.
> The latter isXSQLVAR::sqlsubtype have charset_id in low byte and collate_id in high byte
> deduced from a charset id. Where does he get that charset id?
>>>2. Where does Milan's code get that info from?See above
>>>3. Why doesn't fbclient have that info?See above
>>
>> Because fbclient doesn't know what UTF8 is and how convert it into
>> UCS. FB client is rather simple tosser of data from transport packets
>> into client structures and back.
>
> Does fbclient know the charset id?
>>>4. Can FB be changed so fbclient can get that info in the future, andIt will require that fbclient know about all charsets supported by server.
>>>use it to trim the buffer to the right size before passing it to the
>>>client application?
Note, server could be another version that client, even higher.
>> Maybe, but so far nobody knows a good way to accomplish that.See above
>
> Can fbclient be provided with the charset id?
...
>>>That should 1) reduce the amount of client application bugs and 2) make it easier forClient application already have all necessary info to do it
>>>client application code to trim the buffer content correctly.
Regards,
Vlad