Page 1 of 1
mySQL and UniCode
Posted: Tue 13 Dec 2011 09:57
by PatrikT
Hi,
I'm Testing your unidac component, but I can't get it working with UTF8 in my DB. I have set Charset to UTF8, UseUnicode = True, but still not showing correct Values.

Posted: Tue 13 Dec 2011 12:55
by AndreyZ
Hello,
You cannot show Unicode characters in the standard visual components in all Delphi versions earlier than Delphi 2009 because they do not support Unicode. Delphi 2009 and higher versions have full Unicode support. To solve the problem, you should use Delphi 2009 at least, or you can use some third-party visual components for displaying data with Unicode support.
I'm using XE2
Posted: Tue 13 Dec 2011 12:59
by PatrikT

I'm using XE2 but it's still not shown...
Posted: Tue 13 Dec 2011 16:11
by PatrikT
- Win7 64bit
- mySQL 5
- Delphi XE 2 Update 2
Posted: Tue 13 Dec 2011 16:51
by AndreyZ
I have created the following table:
Code: Select all
CREATE TABLE testutf
(
id INT(11) NOT NULL AUTO_INCREMENT,
txt VARCHAR(40) DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB
AUTO_INCREMENT = 1
CHARACTER SET utf8
COLLATE utf8_general_ci;
, inserted the following data:
Code: Select all
INSERT INTO testutf (txt) VALUES ('ѮѶѪ')
, and used the following code:
Code: Select all
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
UniConnection1.ProviderName := 'MySQL';
UniConnection1.Server := 'server';
UniConnection1.Port := 3306;
UniConnection1.Database := 'database';
UniConnection1.Username := 'username';
UniConnection1.Password := 'password';
UniConnection1.LoginPrompt := False;
UniConnection1.SpecificOptions.Values['UseUnicode'] := 'True';
UniQuery1.Connection := UniConnection1;
UniQuery1.SQL.Text := 'select * from testutf';
UniDataSource1.DataSet := UniQuery1;
DBGrid1.DataSource := UniDataSource1;
UniQuery1.Open;
end;
Data from the testutf table was correctly shown in the TDBGrid component. Please check if this example works for you.