Invalid UTF-8 byte sequence detected

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
zydoon
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.03.2006, 11:36
Location: Tunis
Contact:

Invalid UTF-8 byte sequence detected

Post 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.
rchurch
Fresh Boarder
Fresh Boarder
Posts: 8
Joined: 12.02.2006, 14:52

Post 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.
zydoon
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.03.2006, 11:36
Location: Tunis
Contact:

Post 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.
btrewern
Expert Boarder
Expert Boarder
Posts: 193
Joined: 06.10.2005, 18:51

Post 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
zydoon
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.03.2006, 11:36
Location: Tunis
Contact:

Post 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)
zydoon
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.03.2006, 11:36
Location: Tunis
Contact:

Post by zydoon »

It's working with UTF8 too
thank you very much :)
tiquy26
Fresh Boarder
Fresh Boarder
Posts: 1
Joined: 23.03.2006, 18:14

Post 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)
zydoon
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: 02.03.2006, 11:36
Location: Tunis
Contact:

Post by zydoon »

Hi,
you can hardcode it the object inspector at the "properties" parameter.
Post Reply