Subject | Re: [IBO] How to get Delphi + IBObjects to read/write in unicode to Firebird 1.5 |
---|---|
Author | cognitocognito |
Post date | 2005-11-04T10:42:37Z |
> Hmmm, I can't solve you problems, only share some experiences.I've
> fiddled with it; though I lack a source of Unicode data, thatalways clues
> up with me getting stuck on testing characters beyond the 7-bitrange.
>that both
> As long as you are in the process of trying out stuff, make sure
> the default character set of the database AND the character set ofthe
> connection are UNICODE_FSS. The decisions that the server makesabout the
> charset of the incoming data are dependent on the client "knowing"what
> kind of data it is passing.that's
>
> In Fb 1.5, there's a bit of leeway if you hit a database or column
> defined for unicode_fss with client data that is charset NONE, butI
> haven't tested it myself. As far as I can work out, this cansimplify
> things only in the case where there's a mismatch between thecharacter set
> of the data and a defined default charset. It might not work wherethe
> default charset of the DB is one charset while the defined charsetof the
> specific column is different.your app
>
> Anyway, you don't say which Firebird you're using.
>
> I don't (so far) know of any magic bullet that you can fire into
> that works for both reading and writing. If everything matches upand you
> have components that know how to display and interpret UNICODE_FSS,then
> selects and displays with the TIBODatasets should be OK. If thecontrols
> are doing their job, they should be updating the dataset properly.get a bit
>
> It's when you come to read variables into parameters that things
> queasy sometimes. Delphi's widestring stuff doesn't cater for MBCSwider
> than 2 bytes; unicode_fss is a fixed 3 bytes for every glyph, eventhe
> 7-bit set.reading
>
> I seem to recall in my experiments with the Tnt controls that
> values from the dataset's Fields[] array AsRawString directly intoproperties that
> Params[n].Value is fine; but you may need custom xxxxSQL
> contain the introducer syntax, to get user inputs into parametervalues.
>is one
> There are also issues like whether the font being used in controls
> that supports Unicode (not many do!) and (maybe) OEM codepageissues (the
> codepage being the set of glyphs that the OS associates withspecific
> character codes from input devices and to output devices).a TI
>
> Not much help, I know. It's been in my mind for a long time to do
> sheet on handling MBCS in IBO apps. I hope someone who is doingit "for
> real" will step up and advise you (Daniel Rail?) and we canassemble enough
> to do a demo app...but it won't be now, since I'm flat out with 3lots of
> release notes and the organisation details of the Fb conference andtoo
> short on sleep to concentrate on yet another thing.Thanks for you help Helen.
>
> Helen
>
Just to let you know I did mention the version of Firebird I was
using in the title.
I have managed to get it all working in unicode with very few
changes. I now have japanese displaying in my system on my english
uk machine.
Leaving the database completely the same as I inherited it mainly
with charset NONE in place, I use the TNT controls and the Arial
Unicode MS font both of which I was already using and the only
difference I made to the reading and writing of the database was to
use the WideStringToUTF8String and UTF8StringToWideString from the
unicode unit from Delphi Fundamentals -
http://fundementals.sourceforge.net/unicode.html in the following
format:
paramByName('UnicodeText').AsString := WideStringToUTF8String
(TntEdit1.Text);
and
TntEdit1.Text := UTF8StringToWideString(fieldByName
('UnicodeText').AsString);
I have tested reading and writing many other non-latin characters and
they all save and re-appear correctly.
Just wanted to share this with others and hope that it might be of
some help.