Non ascii characters problems DXE7 / DbExpress 4.5.8

Non ascii characters problems DXE7 / DbExpress 4.5.8

Postby 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,
jerduval
 
Posts: 20
Joined: Mon 13 Sep 2010 08:33
Location: Colombes, France

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Postby 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';
ViktorV
Devart Team
 
Posts: 1867
Joined: Wed 30 Jul 2014 07:16

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Postby 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.
jerduval
 
Posts: 20
Joined: Mon 13 Sep 2010 08:33
Location: Colombes, France

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Postby 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.
ViktorV
Devart Team
 
Posts: 1867
Joined: Wed 30 Jul 2014 07:16

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Postby 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
jerduval
 
Posts: 20
Joined: Mon 13 Sep 2010 08:33
Location: Colombes, France

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Postby 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.
ViktorV
Devart Team
 
Posts: 1867
Joined: Wed 30 Jul 2014 07:16


Return to dbExpress driver for InterBase & Firebird