Page 1 of 1

Invalid UTF-8 byte sequence detected

Posted: 25.03.2006, 13:32
by zydoon
Hi,
I'm developping a delphi app with pgSQL 8.1 as backend through zeosLIB 6.5.1 alpha.

Whenever I try to post some UTF8 characters I get this message :

Code: Select all

... EZSQLException with message 'SQL Error: ERROR: Invalid UTF-8 byte sequence detected near byte 0xe0'.
can someone help please ?
Thanks,
Zied.

Posted: 06.04.2006, 12:50
by rchurch
I think some parameters have to be set to allow the code to work properly.

In reading up on the issue this is what I came across - adding this to the params section of your Connection component might help.
SET CLIENT_ENCODING = 'Latin9'
Query the postgresql mailing lists for a response. The outcome will be of interest to me as I am planning to change my databases to utf8. It appears to be the preferred option in these multilingual times.

Posted: 06.04.2006, 13:21
by zydoon
Thank you for your reply.
It doesn't work :(
I tried it in the connectin params
and in the postgres.conf file.
in the postgres.conf client_encoding defaults to database enconding, which is UTF8 and should accept 'éè.....' caracters.
I foreced it anyway and still got the error.
Again thank you.

Posted: 06.04.2006, 16:15
by btrewern
Check to make sure that the

Code: Select all

SET client_encoding = 'LATIN9'
is working.
try

Code: Select all

SELECT current_setting('client_encoding');
against the same connection to see if the parameter worked.

Regards,

Ben

Posted: 06.04.2006, 18:20
by zydoon
Misteriously it's working now !
the only thing I did it was a rebooot.
I'm giving it a try with UTF8 (or UNICODE whatever it is)

Posted: 06.04.2006, 18:22
by zydoon
It's working with UTF8 too
thank you very much :)

Posted: 07.04.2006, 19:03
by tiquy26
Congratulations!!,

Only one question: How I set this section to my Connection component.
I'm using
ZConnection1: TZConnection;

I think this:

ZConnection1.Properties.add("client_encoding = 'UTF8'")

But I don't know how to do it.

Thank you.
(I'm Peruvian)

Posted: 07.04.2006, 23:56
by zydoon
Hi,
you can hardcode it the object inspector at the "properties" parameter.