Subject Re: [firebird-support] Bug with character sets
Author Martijn Tonies
Hello Milan,

> Firebird returns the character set ID as part of result. You need to
> read in the field RDB$BYTES_PER_CHARACTER from table RDB$CHARACTER_SETS
> for that RDB$CHARACTER_SET_ID and then divide the reported length with
> this number. When done, use the result to truncate the returned string
> to that many characters. Example:
>
> 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.

Could be me, but isn't the -database server- supposed to return this
character data correctly? If there's a Y stored in UTF8 format, it should
return a Y in UTF8 format. Why does it return 'Y<<<' (where < is space)

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