Non ascii characters problems DXE7 / DbExpress 4.5.8

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for InterBase & Firebird in Delphi and C++Builder
Post Reply
jerduval
Posts: 23
Joined: Mon 13 Sep 2010 08:33
Location: Colombes, France

Non ascii characters problems DXE7 / DbExpress 4.5.8

Post by jerduval » Mon 23 Mar 2015 16:30

Hi,

We are migrating our source code from Delphi XE2 to Delphi XE7.
We used dbExpress for Ib version 4.5.8.

When accessing database with "Default character set" set to UTF8, we have problems when string contains non ascii characters (Fields are Varchar(xx) type).
Exemple "é" appears "é"

We initialize the TSQLSconnection like :

Code: Select all

  ACnx.DriverName := {!4}'DevartInterBase';
  ACnx.GetDriverFunc := {!4}'getSQLDriverInterBase';
  ACnx.LibraryName := {!4}'dbexpida40.dll';
  ACnx.VendorLib   := {!4}'fbclient.dll';
  ACnx.Params.Clear;
  ACnx.Params.Values[{!4}'User_Name'] := Username;
  ACnx.Params.Values[{!4}'Password']  := Password;
  ACnx.Params.Values[{!4}'Database'] := Server + {!4}'/' + IntToStr(Port) + {!4}':' + BddFilename;
For information, we done the same initilisation in Delphi XE2.

We tried to add this parameters :

Code: Select all

  ACnx.Params.Values['UseUnicode'] := 'False';
  ACnx.Params.Values['Charset'] := 'UTF8';
But it there is same problem.

Can you help us ?

Regards,

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

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Post by ViktorV » Tue 24 Mar 2015 09:06

To solve the problem, try to set the UseUnicode parameter of TSQLConnection to True:

Code: Select all

  SQLConnection.Params.Values['UseUnicode'] := 'True';

jerduval
Posts: 23
Joined: Mon 13 Sep 2010 08:33
Location: Colombes, France

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Post by jerduval » Tue 24 Mar 2015 10:16

Hi ViktorV,

Thank you for the idea, it works fine.

Maybe you should modify the FAQ :
UseUnicode
Enables or disables Unicode support. Affects character data fetched from the server. When set to True all character data is stored as WideStrings and TStringField is replaced with TWideStringFiled.
This option is available for Delphi 2006 and higher IDE versions.
Default value of this option is True for Delphi 2009 and higher IDE versions, and False for Delphi 2006 and 2007.
Regards.

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

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Post by ViktorV » Tue 24 Mar 2015 13:40

Feel free to contact us if you have any further questions about dbExpress driver for InterBase and Firebird.
Please clarify, what do you mean by adding changes to FAQ?
Last edited by ViktorV on Tue 24 Mar 2015 16:48, edited 1 time in total.

jerduval
Posts: 23
Joined: Mon 13 Sep 2010 08:33
Location: Colombes, France

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Post by jerduval » Tue 24 Mar 2015 14:01

ViktoV,
I don't have any further questions.
I tell you that it should be an error in the FAQ : The default value for UseUnicode params is true, if it was right we dont need to add this param (like you said me to do) ?
Regards

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

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Post by ViktorV » Wed 25 Mar 2015 10:46

The default value of the UseUnicode option is True for Delphi 2009 and higher IDE versions, and False - for Delphi 2006 and 2007, as described in our documentation.
In your case, you had to set the UseUnicode option of TSQLConnection to True, perhaps, because the ACnx.Params.Clear method is executed before this.

Post Reply