UTF 8 error

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for PostgreSQL in Delphi and C++Builder
Post Reply
felipeiw
Posts: 10
Joined: Mon 29 Mar 2010 16:26

UTF 8 error

Post by felipeiw » Mon 29 Mar 2010 16:45

Using delphi 7 with PG 8.4 Database configuration:
ENCONDING: UTF8
LC_COLLATE: Portuguese, Brazil
LC_CTYPE: Portuguese, Brazil

When ApplyUpdates(0) with caract, return error:
SQL Server Error: invalid byte sequence for encoding "UTF8": 0xd652

how to fix it ?

I'm using DBXCONNECTIONS.INI for configure.

Please

Thanks

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Tue 30 Mar 2010 14:35

The problem is that dbExpress driver uses "UTF8" encoding by default. To solve your issue you should set correct charset for your TSQLConnection.

You can use two ways to define charset:

1. To define charset charset as it is described in the "Readme.html" file:

const
coCharset = TSQLConnectionOption(204);

do it in the AfterConnect event of TSQLConnection:
SQLConnection1.SQLConnection.SetOption(coCharset, Integer(PChar('Your_CharSet')));


2. Set the parameter in the Params property of TSQLConnection component or in the "DBXCONNECTIONS.INI" file:

ServerCharSet=Your_CharSet

Post Reply