Re: [firebird-support] Re: Unicode text in Exception?
Hello Dmitry, I'm still puzzled. >29.01.2015 19:15, Martijn Tonies wrote: >> >>> 2) Create SP with EXCEPTION ERROR 'some Cyrillic string'; >> >> Done. In the source, I see the following: >> >> begin >>exception test _utf8 >> X'31D0A2D095D0A1D0A220D09DD09020D091D0AAD09BD093D090D0A0D0A1D09AD098'; >> end > >You don't need the _utf8 prefix with HEX string if you create SP in UTF8 The hex string is generated automagically when I connect with utf8, enter a string value with Cyrillic character and save the procedure. Upon reloading it from the database, it has this hex string. Without the prefix, the text is stored normal. >connection. When I tried with _utf8, I got some weird results too. >Without _utf8, everything worked fine. But I have a Cyrillic keyboard to >write the error text properly ;-) I removed the _utf8 prefix so I only have the next string, connected with utf8/win1251/win1250 but I always get the same garbage returned. I'm doing this using DevArt IBDAC, but I get the same using isql. No clue why I can't get the correct text. 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!
Re: [firebird-support] Re: Unicode text in Exception?
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 9BD093D090D0A0D0A1D09AD098 FF0E01020115070019014C >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!
Re: [firebird-support] Re: Unicode text in Exception?
>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? >> 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? 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!
Re: [firebird-support] Re: Unicode text in Exception?
btw, in Firebird 3, the RDB$EXCEPTIONS.RDB$MESSAGE is still NONE. >> Oh bugger. >> >> Now, I tried the following in the procedure to work around the above: >> >> exception test _utf8 'unicode string here'; >> >> When I look at RDB$PROCEDURES.RDB$PROCEDURE_SOURCE I can see >> the text is inserted as a hex string. >> >> But this doesn't seem to work either? >> >> Does this work at all with Exceptions? > >AFAIU, your trick (exception parameter) should work. Hmm, I'm puzzled then, cause it doesn't seem to work at first sight. 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! Posted by: "Martijn Tonies (Upscene Productions)" ++ Visit http://www.firebirdsql.org and click the Documentation item on the main (top) menu. Try FAQ and other links from the left-side menu there. Also search the knowledgebases at http://www.ibphoenix.com/resources/documents/ ++ Yahoo Groups Links
Re: [firebird-support] Re: Unicode text in Exception?
>> Oh bugger. >> >> Now, I tried the following in the procedure to work around the above: >> >> exception test _utf8 'unicode string here'; >> >> When I look at RDB$PROCEDURES.RDB$PROCEDURE_SOURCE I can see >> the text is inserted as a hex string. >> >> But this doesn't seem to work either? >> >> Does this work at all with Exceptions? > >AFAIU, your trick (exception parameter) should work. Hmm, I'm puzzled then, cause it doesn't seem to work at first sight. 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!
Re: [firebird-support] Re: Unicode text in Exception?
>> I have an EXCEPTION object with a Unicode text in it, a stored procedure >> raises this exception. >> The client application can view the Unicode text just fine when it >> retrieves the Exception meta data, but when the exception is raised, >> Firebird doesn’t seem to translate the text. >> Any idea how to do this? > >Historically, RDB$EXCEPTION_MESSAGE has NONE charset, so it's never >transliterated to the client charset. The engine simply has no idea that >you stored UTF8 there. Sigh. Oh bugger. Now, I tried the following in the procedure to work around the above: exception test _utf8 'unicode string here'; When I look at RDB$PROCEDURES.RDB$PROCEDURE_SOURCE I can see the text is inserted as a hex string. But this doesn't seem to work either? Does this work at all with Exceptions? 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!