Hi,
I've installed dbxpgsql100.exe, version 1.0.0.4, to be used with BDS 2006.
But I'm having problems when I try to execute a SELECT statement using accentuated parameters, as in the example below:
SQLQuery.SQL.Text := 'SELECT cod_bairro FROM bairro WHERE descricao = ' + QuotedStr('Universitário');
SQLQuery.Open;
When this TSQLQuery component try to open a dataset, an exception is raised:
Database Server Error: invalid byte sequence for encoding "UTF8": 0xe17269
But if I execute the following statement:
SQLQuery.SQL.Text := 'SELECT cod_bairro FROM bairro WHERE descricao = ' + QuotedStr('Universitario');
SQLQuery.Open;
No problem happens. As you can see, I've just replaced the parameter value "Universitário" to "Universitario".
My database was created using UTF8 encoding.
How can I solve this problem?
Fabrício
UTF8 encoding error
The following code solves this problem:
const
coUseUnicode = TSQLConnectionOption(209); // boolean
...
SQLConnection1.Connected := True;
SQLConnection1.SQLConnection.SetOption(coUseUnicode, Integer(True));
...
It only works calling SQLConnection1.SQLConnection.SetOption method after connecting to database.
Fabrício
const
coUseUnicode = TSQLConnectionOption(209); // boolean
...
SQLConnection1.Connected := True;
SQLConnection1.SQLConnection.SetOption(coUseUnicode, Integer(True));
...
It only works calling SQLConnection1.SQLConnection.SetOption method after connecting to database.
Fabrício