Page 1 of 1

Non ascii characters problems DXE7 / DbExpress 4.5.8

Posted: Mon 23 Mar 2015 16:30
by jerduval
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,

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Posted: Tue 24 Mar 2015 09:06
by ViktorV
To solve the problem, try to set the UseUnicode parameter of TSQLConnection to True:

Code: Select all

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

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Posted: Tue 24 Mar 2015 10:16
by jerduval
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.

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Posted: Tue 24 Mar 2015 13:40
by ViktorV
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?

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Posted: Tue 24 Mar 2015 14:01
by jerduval
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

Re: Non ascii characters problems DXE7 / DbExpress 4.5.8

Posted: Wed 25 Mar 2015 10:46
by ViktorV
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.