utf8 text field

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andrea.m86
Posts: 25
Joined: Thu 26 May 2011 10:36

utf8 text field

Post by andrea.m86 » Thu 13 Nov 2014 08:32

Hi,
I've a question about using your components for accessing text fields.
I've a database (mysql 5.6) with several text and mediumtext field which have utf8_bin as collation.
I've set in my connection the properties:
useunicode = true
charset = utf8
When i try to access, read or write those fields i've got problems with the character.
I've read some discussions about that on this forum but i didn't understand if it's possible to automatically manage those kind of fields with a dbaware component like i do with the varchar fields.

Am i doing something wrong (maybe missing some properties) or is it necessary to write some code when i read and when i write on those fields?

thanks.
Andrea

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: utf8 text field

Post by ViktorV » Thu 13 Nov 2014 13:58

Please check what types your Text or MediumText data are mapped to. If to Blob - you have 2 options to solve the issue:
1. Remove the binary tag from the fields definition on the server.
2. You can map data of such columns to WideMemo. Example:

Code: Select all

MyTable.DataTypeMap.AddFieldNameRule(FieldName, ftWideMemo);
If data of your fields are mapped to WideMemo and the error is reproduced, then please send us a small sample to demonstrate the issue, including a script to create database objects.

andrea.m86
Posts: 25
Joined: Thu 26 May 2011 10:36

Re: utf8 text field

Post by andrea.m86 » Fri 14 Nov 2014 14:36

hi
Thank you for your hint.
I've solved in a little different way.
Since I always use blob fields as memo in my applications I've defined a mapping between the database blob fields and the WideMemo Field type on the connections.
Now everything work fine.
Thanks

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: utf8 text field

Post by ViktorV » Mon 17 Nov 2014 08:55

It is good to see that the problem has been solved.
Feel free to contact us if you have any further questions.

Post Reply