MySQL UTF8 Charset

In this forum we will discuss things relating the ZEOSLib 6.6.x stable versions

Moderators: gto, EgonHugeist

jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre
Contact:

MySQL UTF8 Charset

Postby jjeffman » 26.08.2015, 19:45

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
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br

marsupilami
Gold Boarder
Gold Boarder
Posts: 589
Joined: 17.01.2011, 14:17

Re: MySQL UTF8 Charset

Postby marsupilami » 27.08.2015, 17:01

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

jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre
Contact:

Re: MySQL UTF8 Charset

Postby jjeffman » 27.08.2015, 19:00

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
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br

jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre
Contact:

Re: MySQL UTF8 Charset

Postby jjeffman » 29.08.2015, 17:30

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.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br

jjeffman
Senior Boarder
Senior Boarder
Posts: 56
Joined: 25.08.2005, 12:40
Location: Porto Alegre
Contact:

Re: MySQL UTF8 Charset

Postby jjeffman » 31.08.2015, 16:34

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.
Jayme Jeffman Filho

DBA, Software Engineer
Sul Engenharia e Sistema Ltda

http://www.sulenge.com.br


Return to “6.6 - stable”

Who is online

Users browsing this forum: No registered users and 1 guest