Subject Re: [firebird-support] Bug with character sets
Author Martijn Tonies
>> But the (X)SQLDA does not contain N. It does however contain charset id,
>> which can be used to obtain "max bytes per char", which can be used in
>> combination with the buffer size specified in SQLDA to determine N.
>
> That is not correct. If I use UTF-8, one character can be 1 to 4 bytes.
> Using the buffersize and the 'max bytes per char' you will NOT be able to
> compute the characterlength.
>
> Example:
> buffer length of 4 bytes, UTF-8 (max 4 bytes per character): is this 1, 2,
> 3 or 4 characters? You simply don't know until you decode.

Mark, correct, you decode and you know the number of characters.

The problem is, the buffer is padded with spaces and those are valid
characters.

Now, how many of those decoded valid characters do you need? That's
the problem at hand.

With regards,

Martijn Tonies
Upscene Productions
http://www.upscene.com

Download Database Workbench for Oracle, MS SQL Server, Sybase SQL
Anywhere, MySQL, InterBase, NexusDB and Firebird!

Database questions? Check the forum:
http://www.databasedevelopmentforum.com