Subject Re: [firebird-support] Re: UTF8 problem with FB 2.1.3
Author Michael Ludwig
Paul Vinkenoog schrieb am 07.01.2011 um 14:20 (+0100):
> Michael Ludwig wrote:
>
> > With isql (or other terminal stuff), you have to take into account the
> > terminal itself, of course. It does work in cmd.exe, at least for simple
> > cases like Reißwolf:
> >
> > \,,,/
> > (o o)
> > ------oOOo-(_)-oOOo------
> > :: chcp 65001
> > Aktive Codepage: 65001.
> >
> > :: Firebird_2_5\bin\isql.exe eins25 -u milu -p bla -ch utf8
> > Database: eins25, User: milu
> > SQL> input T:\MiLu\Dev\SQL\Firebird\charset-names.utf8.sql;
> >
> > S
> > ================================================
> > Reißbrett
> > Reißbrett
>
> Strange... I don't know how your input file was coded

UTF-8 without BOM. Using Vim:

:set fenc=utf8
:set nobomb
:w

set autoddl off;
--create table utable (s varchar(12) character set utf8);
--commit;
insert into utable values ('Reißbrett');
insert into utable values (_utf8 'Reißbrett');
insert into utable values ('Ödnis');
insert into utable values ('Übel');
insert into utable values ('Äpfel');
select s from utable;
commit;
--drop table utable;
--commit;

The above script also works properly, both creating the table and using
an existing one, provided the following is in effect:

* cmd.exe or PowerShell
* chcp 65001
* file encoding UTF-8 without BOM
* isql -ch utf8 (version "WI-V2.5.0.26074 Firebird 2.5")
* using INPUT command

> but if I set the codepage to 65001 and invoke isql with connection
> charset utf8, I get this when selecting from the table:
>
> Reiábrett Reißbrett Reißbrett

Selecting and the input file do work for the few cases I've tried.

It seems that support for codepage 65001 in cmd.exe is weak, though. And
possibly also in isql. My isql process dies instantly and without error
message when I try:

insert into utable values ('ü');

Also using PowerShell, which appears to handle encoding issues somewhat
differently.

> And if I *type* accented characters or eszetts, they don't appear on
> the screen. Sometimes they backspace the prompt away though! (In isql
> as well as on the Windows command line.)
>
> I'm using Win7 Pro 64 bits. And you?

Win32 XP Home in this example.

Cmd.exe is just a far cry from a proper terminal and shell. And I'm not
sure how PowerShell is supposed to behave with regard to encodings.
Looks like it prefers UTF-16LE/BOM.

Michael