Subject Re: [firebird-support] Re: Unicode text in Exception?
Author Martijn Tonies (Upscene Productions)
Hello Dmitry,

>>> btw, in Firebird 3, the RDB$EXCEPTIONS.RDB$MESSAGE is still NONE.
>>
>> Would it make sense to encode the message according to the given
>> connection
>> character set?
>
>Do you mean changing RDB$EXCEPTIONS.RDB$MESSAGE to UTF8? It was
>discussed but ended nowhere.

No, I meant a runtime encoding when sending the text to the client.

Or perhaps storing it as UNICODE_FSS, same as $SOURCE or $DESCRIPTIONs are
stored?

>>>> Now, I tried the following in the procedure to work around the above:
>>>>
>>>> exception test _utf8 'unicode string here';
>>
>> Any idea why this won't work either? Or at least, not in my test?
>
>I tried without the _utf8 prefix and it worked:

I'm trying this in Database Workbench, this works:
select 'ТЕСТ НА БЪЛГАРСКИ'
from rdb$database

>1) Connect as UTF8 charset

Yep.

>2) Create SP with EXCEPTION ERROR 'some Cyrillic string';

Done. In the source, I see the following:

begin
exception test _utf8
X'31D0A2D095D0A1D0A220D09DD09020D091D0AAD09BD093D090D0A0D0A1D09AD098';
end

>3) Validate that RDB$PROCEDURES.RDB$PROCEDURE_BLR (not
>RDB$PROCEDURE_SOURCE!) really contains a Unicode string

In the BLR, I see:

0502040101000700029B110002028006 //
0454455354150F0400210031D0A2D095 // TEST ... ! then the same as above in hex
D0A1D0A220D09DD09020D091D0AAD0
9BD093D090D0A0D0A1D09AD098FFFF
FF0E010201150700000019010000FFFF4C

>4) Connect as WIN1251, execute SP - error text is Cyrillic
>5) Connect as WIN1250, execute SP - cannot transliterate character
>between character sets

When executing the procedure, UTF8/WIN1251/WIN1250 connected, I get:
exception 1 TEST 1ТЕСТ НА БЪЛГАРСКИ At procedure 'TEST' line:
4, col: 3

This -could- be my error, but how do I verify?

When I try in isql, I get the same.

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!