FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.26k stars 217 forks source link

ISQL -X ignores connection charset for text of EXCEPTION message (restoring it in initial charset when exception was created) [CORE5209] #5490

Open firebird-automations opened 8 years ago

firebird-automations commented 8 years ago

Submitted by: @pavel-zotov

Attachments: console-screens-after-extract-metadata-by-isql-x-chutf8--non-readable-exception-message.PNG notepad-plus-plus-does-recognizes-code-page-of-file-by-exception-message-thus-we-cannot-read-SP-comments.PNG

Following was done on Windows XP with locale = RU_ru, ISQL from FB 2.5.6:

C:\>chcp 1251 Текущая кодовая страница: 1251

C:\>cd \temp

C:\TEMP>C:\MIX\firebird\fb25\bin\isql -q SQL> set names win1251; SQL> create database 'localhost/3255:c:\temp\tmpcp1251.fdb'; SQL> set term ^; SQL> create procedure sp_test as CON> begin CON> -- процедурка для проверки складских остатков CON> /* написана очень умными сотрудниками склада */ CON> end ^ SQL> set term ;^ SQL> commit; SQL> create exception ex_neg_remainder 'Операция невозможна: остаток на складе станет отрицательным.'; SQL> commit; SQL> exit;

If we check now metadata using connection charset = WIN1251 - all works fine, every non-ascii message is readable:

C:\TEMP>C:\MIX\firebird\fb25\bin\isql localhost/3255:c:\temp\tmpcp1251.fdb -ch win1251 -x

SET SQL DIALECT 3; ... /* Exceptions */ CREATE EXCEPTION EX_NEG_REMAINDER 'Операция невозможна: остаток на складе станет отрицательным.'; ... ALTER PROCEDURE SP_TEST AS begin -- процедурка для проверки складских остатков /* написана очень умными сотрудниками склада */ end ^ ...

If we do the same (extraction metadata) but using chcp 65001 and charset = UTF8:

C:\TEMP>chcp 65001 Текущая кодовая страница: 65001

C:\TEMP>C:\MIX\firebird\fb30\isql localhost/3333:c:\temp\tmpcp1251_30.fdb -x -ch utf8 1>c:\temp\tmpchcp_30_meta_utf8.log

-- then EXCEPTION message will be encoded win OLD charset = WIN1251 and procedure comments - in UTF8

As result, either we can not read text of exceptions or comments from procedure - see attached screenshots.

firebird-automations commented 8 years ago
Modified by: @pavel-zotov Attachment: console\-screens\-after\-extract\-metadata\-by\-isql\-x\-ch\_utf8\-\_\-non\-readable\-exception\-message\.PNG \[ 12941 \] Attachment: notepad\-plus\-plus\-does\-recognizes\-code\-page\-of\-file\-by\-exception\-message\-thus\-we\-cannot\-read\-SP\-comments\.PNG \[ 12942 \]
firebird-automations commented 8 years ago

Commented by: @aafemt

In next ODS version someone must enshure that ALL text fields in ALL system tables have charset UTF-8.