Hello,
I am stuck again on getting data retrieved using Zeos 6.6.6 stable, this time the target database is MySQL 5.5.
I have configured TZConnection:Properties as follows:
character_set_client=utf8
character_set_connection=utf8
character_set_database=utf8
character_set_results=utf8
character_set_server=utf8
character_set_system=utf8
collation_connection=utf8_general_ci
collation_database=utf8_general_ci
collation_server=utf8_general_ci
Codepage=utf8
I have also run "SET NAMES 'utf8'.
I am encoding the text from the interface ( TMemo, TEdit ) using UTF8Encode() function and UTF8Decode() on the reverse way, so I am able to have TEdit, TMemo and TComboBox text perfectly. I could not correct the data displayed on TDBGrid, though .
Is there a way of correct it ?
Thank you very much
MySQL UTF8 Charset
Moderators: gto, EgonHugeist
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: MySQL UTF8 Charset
Hello jjeffman,
To make a long story short: That is not possible and probably it is not even feasible because the Delphi Controls (TEdit, TMemo, TDBEdit, TDBMemo, TDBGrid) simply don't support Unicode.
This is the long story:
Erm - I don't understand why you would do it like that. If you use Zeos 6.6 with some Delphi or C++ Builder older than Version 7 the recommended way is to have the database do the conversion between your ANSI character set (i.e. WIN1252) and the database character set (UTF8). This is because the Delphi 6 controls cannot display text that is outside the scope of their codepage anyway. They can only display text of one codepage. They cannot display Text that is unicode.
If you want to use Unicode with Delphi 6 you would need some unicode enabled controls like these:
http://tmssoftware.com/site/tmsuni.asp
http://www.yunqa.de/delphi/doku.php/pro ... ls/sidebar
And you also would need a Zeoslib that treats the UTF8-Columns of MySQL as Widestring fields. I am not sure if and under which conditions Zeos 6.6 can do that.
My suggestion to you is: Switch to Lazarus. This way you will get Unicode for free.
With best regards,
Jan
To make a long story short: That is not possible and probably it is not even feasible because the Delphi Controls (TEdit, TMemo, TDBEdit, TDBMemo, TDBGrid) simply don't support Unicode.
This is the long story:
Erm - I don't understand why you would do it like that. If you use Zeos 6.6 with some Delphi or C++ Builder older than Version 7 the recommended way is to have the database do the conversion between your ANSI character set (i.e. WIN1252) and the database character set (UTF8). This is because the Delphi 6 controls cannot display text that is outside the scope of their codepage anyway. They can only display text of one codepage. They cannot display Text that is unicode.
If you want to use Unicode with Delphi 6 you would need some unicode enabled controls like these:
http://tmssoftware.com/site/tmsuni.asp
http://www.yunqa.de/delphi/doku.php/pro ... ls/sidebar
And you also would need a Zeoslib that treats the UTF8-Columns of MySQL as Widestring fields. I am not sure if and under which conditions Zeos 6.6 can do that.
My suggestion to you is: Switch to Lazarus. This way you will get Unicode for free.
With best regards,
Jan
Re: MySQL UTF8 Charset
How difficult is to migrate from Zeos version 6.6 stable to version 7.1 stable ?
I will retrieve the text columns converted to Latin1, the database is congured as utf-8 collate utf8_general_ci.
Thank you very much.
Best regards
I will retrieve the text columns converted to Latin1, the database is congured as utf-8 collate utf8_general_ci.
Thank you very much.
Best regards
Re: MySQL UTF8 Charset
Hello,
Well, while waiting for answers I have changed the schema charset and collation to latin1 / latin1_swedish_ci and I stil cannot have have Portuguese characters like "é" correctly shown on the DBGrid.
I am using Devart VCL ODAC components to deal with Oracle and DBGrid, when connected to ODAC DataSet's, works fine. When I set ODAC connection to Unicode mode they retrieve characters as WideString.
I think the bottleneck is Zeos version 6.6.6 components which do not use WideString isn't it ?
Thank you very much.
Kind regards.
Well, while waiting for answers I have changed the schema charset and collation to latin1 / latin1_swedish_ci and I stil cannot have have Portuguese characters like "é" correctly shown on the DBGrid.
I am using Devart VCL ODAC components to deal with Oracle and DBGrid, when connected to ODAC DataSet's, works fine. When I set ODAC connection to Unicode mode they retrieve characters as WideString.
I think the bottleneck is Zeos version 6.6.6 components which do not use WideString isn't it ?
Thank you very much.
Kind regards.
Re: MySQL UTF8 Charset
Hello,
Finally I have succeeded on showing Portuguese characters on the DBGrid, but I had to convert also the script file used to create the schema and insert the basic data to ISO-8859-1.
Please mark the question as solved.
Kind regards.
Finally I have succeeded on showing Portuguese characters on the DBGrid, but I had to convert also the script file used to create the schema and insert the basic data to ISO-8859-1.
Please mark the question as solved.
Kind regards.
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: MySQL UTF8 Charset
Hello, although Google translate worked to a degree, could you please use english on the forums?
This thread is quite old. I am not sure on how to help you - current Zeos versions should do character conversion for you correctly if you configure it correctly. What problems do you get? Which Zeos version do oyu use? Which version of Delphi / Lazarus do you use?
Best regards, Jan
This thread is quite old. I am not sure on how to help you - current Zeos versions should do character conversion for you correctly if you configure it correctly. What problems do you get? Which Zeos version do oyu use? Which version of Delphi / Lazarus do you use?
Best regards, Jan