Page 1 of 1

Invalid byte sequence for encoding UTF8

Posted: Mon 20 Jul 2009 20:00
by ricardo.pascoal
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

Posted: Tue 21 Jul 2009 10:18
by Challenger
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.

Posted: Tue 21 Jul 2009 13:35
by ricardo.pascoal
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

Posted: Fri 24 Jul 2009 07:39
by Challenger
Please try to recreate fields in design time.

Posted: Tue 28 Jul 2009 11:57
by ricardo.pascoal
Hi,
I removed all fileds in TUniTable and recreat it !
I set UseUnicode = True

Now its working !

Thanks !