UTF8 encoding error
Posted: Mon 27 Jul 2009 20:29
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
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