Subject Re: [IBO] Again: Unicode
Author Helen Borrie
At 02:26 PM 22/10/2004 +0000, you wrote:


>I am still in the situation of finding out, whether it is possible
>to migrate my existing Delphi/IBO application to unicode support.
>Some information has been here in the group, but I simply don't get
>anything to work.
>
>I created a sample database with default charset none and created
>the following table:
>
>CREATE TABLE PERSON
>(
> PERSONID INTEGER NOT NULL,
> FIRSTNAME CHAR( 40) CHARACTER SET UNICODE_FSS
>NOT NULL COLLATE UNICODE_FSS,
> LASTNAME CHAR( 40) CHARACTER SET UNICODE_FSS
>NOT NULL COLLATE UNICODE_FSS,
> GENDER CHAR( 10) NOT NULL COLLATE NONE,
> AGE SMALLINT,
> CONSTRAINT PK_PERSON PRIMARY KEY (PERSONID)
>);
>
>firstName and lastName should support unicode, while gender doesn't
>need this.
>
>I then tried to write a small Delphi app to connect to the db as
>follows:
>-created an IB_Connection
>-created an IB_Query with "select * from person" and auto-generated
>update sql
>-created an IB_Datasource, bound to IB_Query
>-dropped an IB_Grid to show the data
>
>Result: everything is fine, but entering unicode (japanese,
>cyrillic, ...) results in "???"
>It seems, the IBO controls don't support Unicode, because the
>default Delphi controls don't.
>
>I then tried the following:
>- use IBOQuery with same select
>- use standard Delphi TDataset
>- bind standard Delphi grid (don't expect this to show Unicode just
>for navigation)
>- download, install and bind TNT Edit box with unicode support
>- set font to Tahoma (otherwise it won't show properly)
>
>Result: everything is find, I can enter unicode chars into the edit
>box, moving to the next record and back shows "???" .... arghh..
>
>Has anyone got anything to run with Unicode+Firebird+IBObjects?
>What am I doing wrong here? What could I do or contribute to make it
>work? Who can help? Please....

Notice, if the TNT edit is displaying "correct" characters as you enter
them, then Delphi is capable of interpreting them.

Do you know about the "introducer" syntax for writing to the db in a
character set that is different from the default character set? Since you
have most of your character fields in unicode and no default character set
in the database or the client, you will need to use it just about
everywhere - and it doesn't work with parameters.

Delphi understands the "Windows locale" character sets, which are rarely
unicode sets; the client and the server have to "know" what they are
dealing with and they *don't* know about locale character sets (even though
some of Firebird's character sets are mapping of common locale sets, e.g.
WIN1252 and such, and you might get the illusion that it does recognise the
locale.)

One thing I suggest you do is read the Delphi help for your version,
regarding character sets. I recall somewhere, sometime, finding that
Delphi works with an enumerated set, which is a subset of possible members,
that varies according to which language distribution of Delphi you
have. There is something you can do (which I don't recall) to modify the
set so it includes the character sets you want your application to handle.

Don't get into the complication of wide strings unless you find you
must. It's a notorious can of worms that not many people understand well
(including me!). If you get something that works with strings, stick with
it. And don't forget that you can't uppercase unicode for storage or
searches, since Firebird's unicode_fss has no upper/lower mappings for any
characters except those that correspond to US ASCII.

I know that's not the final word on it, by any means. It might be worth
your while contacting Peter Jacobi, as he seems to be the one who best
understands the unicode issues, with respect to what the database engine
stores and understands. He's not a Delphi programmer, though...

Apart from that - just Google like crazy for the stuff on the Delphi
side. And, when you're done, write a How-to. :-)

Helen