Subject Re: [ib-support] unicode
Author Helen Borrie
At 04:15 PM 20-05-02 +0800, you wrote:
>Hi everyone,
>
>i have problem when i insert and select data from unicode field in database,
>
>does anyone knows how to insert and select data from unicode field in
>database step by step..??

You can insert text data of any character set into a column, but you can
only successfully select data of a specific character set if BOTH (a) the
column was created in that charset and (b) the data are in that charset.

So begin by creating your database with a default character set of
UNICODE_FSS; or create a domain of charset UNICODE_FSS and create your
column using that domain.

When inserting data, either
a) make sure that your client connection specifies the character set
UNICODE_FSS, though a SET NAMES command or through the API database
parameter block (the item isc_dpb_lc_ctype). Roman explained in
firebird-java how the java database driver surfaces this as a connection
property (lc_ctype=UNICODE_FSS );
or
b) specifically force the data being inserted or updated to be UNICODE_FSS
by preceding the string with the _UNICODE_FSS marker

e.g. insert into tablea(id, unicode_data)
values(99, _UNICODE_FSS 'Now is the time for all good men')

In other words, if the data do not go in as unicode, they will not come out
in a select - you will get a transliteration error instead. Trying to
force unicode data into a non-unicode column won't succeed, either.

cheers,
Helen

All for Open and Open for All
Firebird Open SQL Database · http://firebirdsql.org ·
http://users.tpg.com.au/helebor/
_______________________________________________________