Delphi - DBGrid does not display UTF8 calculated field

4.1k views Asked by At

I have a TDBGrid linked to a TDataSource with a TFibDataSet behind. On the OnCalcFields of the dataset I'm trying to add the string 'Russisch (русский)'.

procedure TForm1.pFIBDataSet1CalcFields(DataSet: TDataSet);
begin
  DataSource1.DataSet.FieldByName('Language').AsString := ('Russisch (русский)');

The problem is that in the grid the result is displayed as :Russisch(????????)

 DataSource1.DataSet.FieldByName('Language').AsWideString :=('Russisch (русский)'); 

has the same result

FibDataBase component has ConnectParams.Charset set to UTF-8. Also I set in the DBParams value lc_ctype=UTF8.

What I'm doing wrong here?

LE: Delphi XE, Firebird and UTF8 - this does not solve my problem.

LE1: Problem occurs only with calculated fields. Live data 'Russisch (русский)' is displayed correctly.

1

There are 1 answers

5
iMan Biglari On BEST ANSWER

I guess you made the same mistake I always make. When you create a field like this:

enter image description here

it's ANSI. You have to select WideString for it to be unicode:

enter image description here