Invalid byte sequence for encoding UTF8

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ricardo.pascoal
Posts: 3
Joined: Mon 20 Jul 2009 19:42

Invalid byte sequence for encoding UTF8

Post by ricardo.pascoal » Mon 20 Jul 2009 20:00

Hi,

First of all, I using a PostgreSQL database that I created with encoding UTF8
and in Delphi 2009 I´m using TUniConnection and a PostgreSQLUniProvider
but when I´gonna save some data that has some accentuation like çÇâé
I got a message Invalid byte sequence for encoding UTF8

I just tried to put a string UTF8 in TUniConnection in parameter Charset, but didnt work it

note : I use a PgAdminIII and I tried to do a SQL INSERT into database and works fine ! just for application dont work !


Does anybody could help me, please ?!

thanks

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Tue 21 Jul 2009 10:18

If you just set Charset to UTF8, you will see data in the UTF8 encoding.

You should leave Charset empty and set UseUnicode = True to make UniDAC decode automatically all data from UTF8 to WideString.

ricardo.pascoal
Posts: 3
Joined: Mon 20 Jul 2009 19:42

Post by ricardo.pascoal » Tue 21 Jul 2009 13:35

Hi Challenger,

I did you said but didnt work yet ! Now I got a message :
type mismatch for field 'XXXXXXXXXX' expecting String actual : widestring

I´m using TUniTable, and it was be very simple... Maybe be a bug with TUniConnection that cant interpret posgres database encoding utf8 ?

any other sugestion ?

thanks

Challenger
Devart Team
Posts: 925
Joined: Thu 17 Nov 2005 10:53

Post by Challenger » Fri 24 Jul 2009 07:39

Please try to recreate fields in design time.

ricardo.pascoal
Posts: 3
Joined: Mon 20 Jul 2009 19:42

Post by ricardo.pascoal » Tue 28 Jul 2009 11:57

Hi,
I removed all fileds in TUniTable and recreat it !
I set UseUnicode = True

Now its working !

Thanks !

Post Reply