Subject UNICODE_FSS troubles
Author peter_jacobi.rm
On the developer list there were just some exchanges
about behaviour of UNICODE_FSS fields on wire protocol.

This got me started to test some examples with ISQL,
and I must confess, I find the results somehat disturbing
and difficult to explain.

Find below a compiled session transcript. I would be very
thankful, if somebody can explain what's going on there.
Especially, as often it's question whether to blame ISQL
or the server.

And perhaps a more general question: Is UNICODE_FSS
successfully deployed and working in real apps or is this
a zombie, neither dead nor alive?

Follows the session transcript, consisting of
three parts:

Comment to first part:
Set Windows Console codepage to 437
Start ISQL session, setting connect charset to DOS437
Create a table with char column having charset DOS437
Insert some data, including some non-ASCII chars


F:\fb15rc4\firebird15\cstest>chcp 437
Active code page: 437

F:\fb15rc4\firebird15\cstest>..\bin\isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set names DOS437;
SQL> connect 'cstest.alias' user 'sysdba' password 'masterkey';
Database: 'cstest.alias', User: sysdba
SQL> create table t4 (c1 char(4) character set DOS437);
SQL> insert into t4 values ('ABC');
SQL> insert into t4 values ('ß');
SQL> insert into t4 values ('ÄÖÜ');

SQL> select c1 from t4;

C1
======
ABC
ß
ÄÖÜ

Comment to second part:
Set Windows Console codepage to 1252
Start ISQL session, setting connect charset to WIN1252
Display the table created before, automatic character
set transliteration works fine.

F:\fb15rc4\firebird15\cstest>chcp 1252
Active code page: 1252

F:\fb15rc4\firebird15\cstest>..\bin\isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set names WIN1252;
SQL> connect 'cstest.alias' user 'sysdba' password 'masterkey';
Database: 'cstest.alias', User: sysdba

SQL> select c1 from t4;

C1
======
ABC
ß
ÄÖÜ

Comment to third part:
Set Windows Console codepage to 65001 (UTF-8)
Start ISQL session, setting connect charset to UNICODE_FSS
Display the table created before:
a) automatic character set transliteration doesn't work.
b) Explicit casting works.
c) Explicit casting even works, when it should fail

F:\fb15rc4\firebird15\cstest>chcp 65001
Active code page: 65001

F:\fb15rc4\firebird15\cstest>..\bin\isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> set names UNICODE_FSS;
SQL> connect 'cstest.alias' user 'sysdba' password 'masterkey';
Database: 'cstest.alias', User: sysdba
SQL> select c1 from t4;

C1
======
ABC
ß
Statement failed, SQLCODE = -802

arithmetic exception, numeric overflow, or string truncation

SQL> select cast (c1 as char(4) character set UNICODE_FSS) from t4;

CAST
============
ABC
ß
ÄÖÜ

SQL> select cast (c1 as char(2) character set UNICODE_FSS) from t4;

CAST
======
ABC
ß
ÄÖÜ

**** end of session transcript

Regards,
Peter Jacobi