[Lazarus] ColotToRGB in GTK apps
skroblas at erdves.lt
Sat Jul 26 20:55:03 CEST 2008
--- El vie 25-jul-08, Osvaldo TCF <arquivostcf at gmail.com> escribió:
> De:: Osvaldo TCF <arquivostcf at gmail.com>
> Asunto: Re: [Lazarus] Firebirdsql Characters Compatibility
> A: "General mailing list" <lazarus at lazarus.freepascal.org>
> Fecha: viernes, 25 julio, 2008, 11:21 am
> You are right. But...
> Pearhaps the problem is in the way of componet get/send
> data from
> database. Not in lazarus.
Perharps there is no problem at all :)
> FirebirdSQL save data as is receved from the client, it use
> de charset
> and the collate for this.
This is not completly right, it seems all depends on three things, the default charset the dataset was created, if not default especified, it depends on fields specicif charset, and last and very important on connection charset.
If database was created with default charset WIN1252 for example and fields do not specify a different charset, then using a connection.charset:='UTF8' will convert all data from WIN1252 to UTF8 on retrieving, so no changes are needed in lazarus application (with unicode support enabled) except by setting the right connection charset, this is IMO, the easiest way to solve the problems. It works also on storing, storing a UTF8 encoded string in database should be fine, provided that UTF8 string has chars that exists in WIN1252 encoding if not, then problems will occur. That's why the best is convert database to UTF8 when possible or when text with different languages is expected.
> When i create a field with utf8 charset i see correct in
> all clients
> with support utf8: lazarus (use utf8, ever) and flamerobin
> (use defined
it will be fine as long as flamerobin registration charset is UTF8 or some charset that matches the data on database. It will not work if for example reg charset is WIN1252 and data in database is russian text.
> The problem is how lazarus send/get data respecting the
> charset of
> component connection.
Conversions are done in database server provided that fields,tables and database are correctly defined.
> Dataset.dataconvert? transliterate? more ideia?
> Em Sex, 2008-07-25 às 14:52 +0200, Joost van der Sluis
> > Op vrijdag 25-07-2008 om 09:35 uur [tijdzone -0300],
> schreef Osvaldo
> > TCF:
> > >
> > > environment
> > > ubuntu 8.04
> > > fpc 2.2.3
> > > lazarus gtk2 r15343
> > > firebird 2.0.4 win1252
> > > components tested: uib + uibdataset ; uib +
> fbdataset ; sqldb + sqlquery
> > >
> > > Problem:
> > > characters 'ã', 'á',
> 'Á' (...) apear diferent in lazarus and flamerobin
> > > and ibeasy. Ibeasy and flamerobin show the same
> form, diferent from
> > > lazarus dataware componets.
connection charset is not mentioned which by default is '' which I don't know how sqldb handle, but if you set UTF8 everything should be fine on recent lazarus. Even in case when evey field specify a different charset.
> > >
> > > When i enter from flamerobin or ibeasy (via wine)
> the characters are
> > > showed normal in flamerobin and ibeasy but apear
> how squares with X
> > > (#225 i think) in lazarus dataware components.
> > This is the same question as in the 'Unicode and
> DBAware' thread. The
> > strings in the database are stored in some local
> character set (probably
> > iso-8859-1) by Ibeasy and Flamerobin. But the latest
> Lazarus version
> > expect all strings to be in utf-8 encoding.
> > So you have two options: store all data in the
> database using utf-8. If
> > Flamerobin and Ibeasy do not support utf-8, you could
> consider using
> > IBExpert, for example. (Windows only)
> > Or you could convert all data read from the dataset
> from the encoding
> > used by Flamerobin and Ibeasy to the utf8-encoding.
> And offcourse, if
> > you store data into the database, you have to convert
> the data from
> > utf-8 to the other encoding. How you can do that you
> can find in my mail
> > in the DBAware-thread. Or you could use the OnGetText
> and OnSetText
> > properties from the TStringFields you are using.
Or as written above, use connection.charset :)
> > I think it's obvious that if you have full control
> over the database,
> > the first option is the best one.
> > There is a change that the second option will be
> automated in fpc 2.4.0
> > or 2.2.4, but that's hard to say now.
> > And I think that, especially when Lazarus 0.9.26 is
> released, we'll get
> > this question very often. Maybe something to mention
> in the releasenotes
> > or the FAQ?
> > Joost.
Jesus Reyes A.
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
Regístrate ya - http://correo.yahoo.com.mx/
More information about the Lazarus