<div dir="ltr">Environment:<br>Ubuntu 8.04<br>firebird 2.0.4 on ubuntu 8.04 tcp connection<br>freepascal 2.2.3<br>lazarus r15343 gtk2<br>components:<br>UIB components + FBDataset<br><br>In database:<br>default charset: iso8859_1 (or win1252)<br>


collate used: PT_BR<br><br>In lazarus:<br>set the characterset para <i>csUNICODE_FSS </i>in JvUIBDatabase.<br><br>Now, all is good.<br><br>The firebird server and firebird client manage the connection properly.<br><br><div class="gmail_quote">
2008/7/26 Jesus Reyes <span dir="ltr"><<a href="mailto:jesusrmx@yahoo.com.mx" target="_blank">jesusrmx@yahoo.com.mx</a>></span><br>

<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
<br>
--- El vie 25-jul-08, Osvaldo TCF <<a href="mailto:arquivostcf@gmail.com" target="_blank">arquivostcf@gmail.com</a>> escribió:<br>
<br>
> De:: Osvaldo TCF <<a href="mailto:arquivostcf@gmail.com" target="_blank">arquivostcf@gmail.com</a>><br>
> Asunto: Re: [Lazarus] Firebirdsql Characters Compatibility<br>
> A: "General mailing list" <<a href="mailto:lazarus@lazarus.freepascal.org" target="_blank">lazarus@lazarus.freepascal.org</a>><br>
> Fecha: viernes, 25 julio, 2008, 11:21 am<br>
<div>> You are right. But...<br>
><br>
> Pearhaps the problem is in the way of componet get/send<br>
> data from<br>
> database. Not in lazarus.<br>
><br>
<br>
</div>Perharps there is no problem at all :)<br>
<div><br>
> FirebirdSQL save data as is receved from the client, it use<br>
> de charset<br>
> and the collate for this.<br>
<br>
</div>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.<br>



<br>
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.<br>



<div><br>
><br>
> When i create a field with utf8 charset i see correct in<br>
> all clients<br>
> with support utf8: lazarus (use utf8, ever)  and flamerobin<br>
> (use defined<br>
> charset).<br>
<br>
</div>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.<br>



<div><br>
><br>
> The problem is how lazarus send/get data respecting the<br>
> charset of<br>
> component connection.<br>
<br>
</div>Conversions are done in database server provided that fields,tables and database are correctly defined.<br>
<div><br>
><br>
> Dataset.dataconvert? transliterate? more ideia?<br>
><br>
> Thanks.<br>
><br>
><br>
><br>
><br>
> Em Sex, 2008-07-25 às 14:52 +0200, Joost van der Sluis<br>
> escreveu:<br>
> > Op vrijdag 25-07-2008 om 09:35 uur [tijdzone -0300],<br>
> schreef Osvaldo<br>
> > TCF:<br>
> > ><br>
> > > environment<br>
> > > ubuntu 8.04<br>
> > > fpc 2.2.3<br>
> > > lazarus gtk2 r15343<br>
> > > firebird 2.0.4 win1252<br>
> > > components tested: uib + uibdataset ; uib +<br>
> fbdataset ; sqldb + sqlquery<br>
> > ><br>
> > > Problem:<br>
> > > characters 'ã', 'á',<br>
> 'Á' (...) apear diferent in lazarus and flamerobin<br>
> > > and ibeasy. Ibeasy and flamerobin show  the same<br>
> form, diferent from<br>
> > > lazarus dataware componets.<br>
<br>
</div>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.<br>



<div><div></div><div><br>
> > ><br>
> > > When i enter from flamerobin or ibeasy (via wine)<br>
> the characters are<br>
> > > showed normal in flamerobin and ibeasy but apear<br>
> how squares with X<br>
> > > (#225 i think) in lazarus dataware components.<br>
> ><br>
> > This is the same question as in the 'Unicode and<br>
> DBAware' thread. The<br>
> > strings in the database are stored in some local<br>
> character set (probably<br>
> > iso-8859-1) by Ibeasy and Flamerobin. But the latest<br>
> Lazarus version<br>
> > expect all strings to be in utf-8 encoding.<br>
> ><br>
> > So you have two options: store all data in the<br>
> database using utf-8. If<br>
> > Flamerobin and Ibeasy do not support utf-8, you could<br>
> consider using<br>
> > IBExpert, for example. (Windows only)<br>
> ><br>
> > Or you could convert all data read from the dataset<br>
> from the encoding<br>
> > used by Flamerobin and Ibeasy to the utf8-encoding.<br>
> And offcourse, if<br>
> > you store data into the database, you have to convert<br>
> the data from<br>
> > utf-8 to the other encoding. How you can do that you<br>
> can find in my mail<br>
> > in the DBAware-thread. Or you could use the OnGetText<br>
> and OnSetText<br>
> > properties from the TStringFields you are using.<br>
<br>
</div></div>Or as written above, use connection.charset :)<br>
<div><br>
> ><br>
> > I think it's obvious that if you have full control<br>
> over the database,<br>
> > the first option is the best one.<br>
> ><br>
> > There is a change that the second option will be<br>
> automated in fpc 2.4.0<br>
> > or 2.2.4, but that's hard to say now.<br>
> ><br>
> > And I think that, especially when Lazarus 0.9.26 is<br>
> released, we'll get<br>
> > this question very often. Maybe something to mention<br>
> in the releasenotes<br>
> > or the FAQ?<br>
> ><br>
> > Joost.<br>
> ><br>
<br>
<br>
</div><font color="#888888">Jesus Reyes A.<br>
</font><div><br>
__________________________________________________<br>
Correo Yahoo!<br>
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!<br>
Regístrate ya - <a href="http://correo.yahoo.com.mx/" target="_blank">http://correo.yahoo.com.mx/</a><br>
</div><div><div></div><div><br>
_______________________________________________<br>
Lazarus mailing list<br>
<a href="mailto:Lazarus@lazarus.freepascal.org" target="_blank">Lazarus@lazarus.freepascal.org</a><br>
<a href="http://www.lazarus.freepascal.org/mailman/listinfo/lazarus" target="_blank">http://www.lazarus.freepascal.org/mailman/listinfo/lazarus</a><br>
</div></div></blockquote></div><br></div>