Test
Mailing lists / lazarus / 2008-07
Test
7 messages · 6 people · –
- OOsvaldo TCF 2
- CCoppola Ing. Salvatore 1
- JJesus Reyes 1
- JJoost van der Sluis 1
- JJoshyFun 1
- OOsvaldo Filho 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Hi all.
I'm using Lazarus r15343 but i test the problem with more recent release.
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.
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.
Thanks.
Op vrijdag 25-07-2008 om 09:35 uur [tijdzone -0300], schreef Osvaldo TCF:
Show quoted text 16 lines
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.
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.
You are right. But...
Pearhaps the problem is in the way of componet get/send data from database. Not in lazarus.
FirebirdSQL save data as is receved from the client, it use de charset and the collate for this.
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 charset).
The problem is how lazarus send/get data respecting the charset of component connection.
Dataset.dataconvert? transliterate? more ideia?
Thanks.
Joost van der Sluis wrote 53 lines
Hello Osvaldo,
Friday, July 25, 2008, 6:21:21 PM, you wrote:
OT> Pearhaps the problem is in the way of componet get/send data from OT> database. Not in lazarus.
OT> FirebirdSQL save data as is receved from the client, it use de charset OT> and the collate for this.
OT> When i create a field with utf8 charset i see correct in all clients OT> with support utf8: lazarus (use utf8, ever) and flamerobin (use defined OT> charset).
OT> The problem is how lazarus send/get data respecting the charset of OT> component connection.
OT> Dataset.dataconvert? transliterate? more ideia?
I'm now using the "AfterOpen" of each TSQLQuery which based in the DEFINE of unicode support, calls a function that hooks the OnGetText/OnSetText of each ftString field. The hook on these functions calls UTF8Encode and UTF8Decode.
In my code this seens to be the more clean way to keep the ISO8859-1 data and UTF8 representation. When upgrade database simple replace the hook function by a dummy one and "voila" ready.
If you already uses the OnGetText/OnSetText in your code this solution will overcomplicate it :(
Perhaps using inheritance and inherited clause
I will test it.
Thank you.
2008/7/25 JoshyFun
Show quoted text 37 lines
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.lazarus.freepascal.org/pipermail/lazarus/attachments/20080725/fff8961b/attachment.html
You are right. But... Pearhaps the problem is in the way of componet get/send data from…
--- El vie 25-jul-08, Osvaldo TCF escribi?:
Show quoted text 10 lines
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.Show quoted text 6 lines
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.
Show quoted text 28 lines
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.
Show quoted text 32 lines
Or as written above, use connection.charset :)
Show quoted text 17 lines
Jesus Reyes A.
__________________________________________________ Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ?gratis! Reg?strate ya - http://correo.yahoo.com.mx/
