Skip site navigation (1) Skip section navigation (2)

Re: 8.0.0beta4: "copy" and "client_encoding"

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: mbch67(at)yahoo(dot)com
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: 8.0.0beta4: "copy" and "client_encoding"
Date: 2004-11-03 20:12:56
Message-ID: 41893BC8.6000201@opencloud.com (view raw or flat)
Thread:
Lists: pgsql-jdbc
mbch67(at)yahoo(dot)com wrote:
> Hi,
> 
> The following statement worked fine with 7.4 but fails under 8.0.0beta4:
> 
>    SET CLIENT_ENCODING TO 'LATIN1';
> 
> Error message:
> 
>    08006
>    The servers client_encoding parameter was changed to {0}.
>    The JDBC driver requires client_encoding to be UNICODE for
>    correct operation.
> 
> Is this a bug or a new restriction of the JDBC driver/server backend?

It's an old restriction of the JDBC driver. It's just that only the new 
driver detects and complains about attempts to change the encoding.

The underlying problem is that currently the driver sets client_encoding 
= UNICODE (which matches the internal Java string representation well) 
and expects it to stay that way for the duration of the connection. If 
you manually change client_encoding, then the driver will happily try to 
decode those LATIN1-encoded strings as UTF8-encoded strings, and get 
very confused..

Why do you need to change client_encoding?

-O

In response to

Responses

pgsql-jdbc by date

Next:From: Dave CramerDate: 2004-11-03 21:19:23
Subject: Re: stable release
Previous:From: Oliver JowettDate: 2004-11-03 20:04:54
Subject: Re: Avoiding explicit addDataType calls for PostGIS

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group