Page 1 of 1

SQL issue with portuguese characters

Posted: Thu 19 Jun 2014 19:45
by WilkinsonDR
Hello, i'm trying to make an insert command into a Oracle Database using dbExpress, but i'm having a issue with portuguese characters being replaced to "¿".

Can you help me?

[Information]
I'm using Delphi XE5 + Oracle 11g.

[SQL Connection Params]
SQLConnection.Params.Values[TDBXPropertyNames.Database] := '192.168.0.41:1521:ORCL';
SQLConnection.Params.Values[TDBXPropertyNames.VendorLib] := 'dbexpoda.dll';
SQLConnection.Params.Values[TDBXPropertyNames.LibraryName] := 'dbexpoda.dll';
SQLConnection.Params.Values[TDBXPropertyNames.GetDriverFunc] := 'getSQLDriverORADirect';
SQLConnection.Params.Values[TDBXPropertyNames.Role] := '';
SQLConnection.Params.Values[TDBXPropertyNames.UserName] := 'GIASSI';
SQLConnection.Params.Values[TDBXPropertyNames.Password] := 'dbaaccesskey';
SQLConnection.Params.Values['Trim Char'] := 'True';
SQLConnection.Params.Values['AutoCommit'] := 'False';
SQLConnection.Params.Values[TDBXPropertyNames.IsolationLevel] := 'Dirty Read';
SQLConnection.Params.Values['LongStrings'] := 'True';
SQLConnection.Params.Values['EnableBCD'] := 'True';
SQLConnection.Params.Values['CharSet'] := 'WE8ISO8859P1';
SQLConnection.Params.Values['ServerCharSet'] := 'WE8ISO8859P1';


[SQL]
CREATE TABLE TEST
(
DESCRIPTION VARCHAR2(100) NOT NULL
);


INSERT INTO TEST(DESCRIPTION)
VALUES ('Descrição')

Re: SQL issue with portuguese characters

Posted: Fri 20 Jun 2014 11:24
by AlexP
To make such query work, you should set the UseUnicode option and UnicodeEnvironment to True:

Code: Select all

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

Re: SQL issue with portuguese characters

Posted: Fri 20 Jun 2014 12:26
by WilkinsonDR
Thank you so much AlexP, it worked perfectly!
AlexP wrote:To make such query work, you should set the UseUnicode option and UnicodeEnvironment to True:

Code: Select all

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

Re: SQL issue with portuguese characters

Posted: Fri 20 Jun 2014 12:48
by AlexP
You are welcome. Feel free to contact us if you have any further questions.