Re: JDBC Default Encoding - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: JDBC Default Encoding
Date
Msg-id Pine.BSO.4.64.0705011200340.25632@leary.csoft.net
Whole thread Raw
In response to JDBC Default Encoding  (Altaf Malik <mmalik_altaf@yahoo.com>)
Responses Re: JDBC Default Encoding  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-jdbc

On Tue, 1 May 2007, Altaf Malik wrote:

> In PGStream, i see the default encoding "US-ASCII" which is overridden
> once we are connected to the database. But, if an error comes while
> connecting to the database for example user name is not correct,
> US-ASCII is used to decode the Server Message which prints ??? instead
> of actual error message when the locale is other than english (in my
> case it was zh_TW.utf8). If i change the default encoding of PGStream to
> UTF8, it works fine. Is there any specific reason for the default
> encoding to be the US-ASCII?
>

Prior to connecting to the database we cannot assume what encoding the
conversation should occur in, so we use the lowest common denominator of
US-ASCII.  I guess the question is, with a database encoding of something
other than UTF-8, does the error message come back in the database
encoding or in UTF-8 like we asked.  I'm not sure when the server applies
our setting of client_encoding.  If it does come back in UTF-8 that would
be a good reason to switch to UTF-8 in the driver earlier, but if it comes
back in the database encoding there's not much we can do about that.

Kris Jurka

pgsql-jdbc by date:

Previous
From: Altaf Malik
Date:
Subject: JDBC Default Encoding
Next
From: Tom Lane
Date:
Subject: Re: JDBC Default Encoding