Subject Re: Help On Unicode!
Author pavel_menshchikov
Hello all,

--- In firebird-support@yahoogroups.com, "peter_jacobi.rm"
<peter_jacobi@g...> wrote:
> --- "pavel_menshchikov" <mpn2001@y...> wrote:
> > Could you tell me please what is the difference using Unicode
> > and "common" character sets/collations?
>
> Unicode supports all characters of all living scripts of the world
> (and some old).
> A common narrow character set supports 256 (or more likely 192)
> characters.
The differences in "constructions" are clear. I wonder why Alan
doesn't recommend to use unicode to novice programmer?

> So, without much guessing, using Unicode will waste performance
> and storage space, if your application can do with a
> supported narrow chaarcter set.
I've read (in IB or FB documentation as I remember) that IB/FB
internally uses unicode to store/manipulate string values, and
converts strings for clients as specified (character set/collation).
Is it right?

> > Some time ago I created the program, which worked quite well with
> > Unicode (I mean inserting and updating). But simple select
statement
> > with "like '%<string_with_non-digit_chars>'" clause made the
FB/IB
> > server down (v. 1.0.3 and 6.0 respectivly).
>
> Test again against FB 1.5.1 and file bug, if it still crashes.
I tried the following with FB 1.5.0.4306 (release):

1. Implementing test DB:
SET NAMES UNICODE_FSS; /* as I understand, that is not for client
connections but for DB objects naming */
SET SQL DIALECT 3;
CREATE DATABASE 'c:\myprojects\ac\v-2\db\ac2.fdb'
USER 'SYSDBA' PASSWORD 'masterkey' PAGE_SIZE 8192
DEFAULT CHARACTER SET UNICODE_FSS;
CREATE DOMAIN CH50 AS VARCHAR(50) CHARACTER SET UNICODE_FSS COLLATE
UNICODE_FSS;
CREATE TABLE TEST(NAME CH50);

2. Populating the test table with several strings in russian.

3. Connecting to the DB using IBExpert:
charset: unicode_fss
additional connect parameters: empty

4. Trying to select data:
select * from test where name like '<string_in_russian>' - server
doesn't response to the windows messages, IBExpert waits for the
server (I think). If I end the server (through task manager),
IBExpert reports about the lost connection.
select * from test where name like '<string_in_russian>' collate
unicode_fss - returns all rows, no matter if the column equal to the
string or not.
select * from test where name like '<string_in_russian>%'
OR
select * from test where name like '%<string_in_russian>%'
OR
select * from test where name like '%<string_in_russian>'
OR
select * from test where name containing '<string_in_russian>' -
returns all rows, no matter if the column contains the string or not.
select * from test where name = '<string_in_russian>'
OR
select * from test where name > '<string_in_russian>'
OR
select * from test where name starting with '<string_in_russian>' -
returns correct result set, but I need "like" in my program.

Am I doing something wrong? Or FB 1.5 still has no full support for
unicode?

Thanks.
Pavel Menshchikov.