Re: How to insert Chinese (big5) through JDBC? - Mailing list pgsql-jdbc

From Kris Jurka
Subject Re: How to insert Chinese (big5) through JDBC?
Date
Msg-id Pine.LNX.4.33.0308020617450.10101-100000@leary.csoft.net
Whole thread Raw
In response to Re: How to insert Chinese (big5) through JDBC?  (Eric Tan <neltan2002@yahoo.com.hk>)
Responses Re: How to insert Chinese (big5) through JDBC?
List pgsql-jdbc

On Fri, 1 Aug 2003, [big5] Eric Tan wrote:

> I guess it was. I doesn't.
>
> CA_care=# SELECT datconfig FROM pg_database WHERE datname='CA_care';
>        datconfig
> ------------------------
>  {client_encoding=Big5}
>
> CA_care=# \encoding
> EUC_TW
>  When I select fields with Chinese content in jsp, it cannot display
> correctly, unless I add this: pgsql.execute("set client_encoding to
> 'Big5';"); and get it pgsql.getChinese2("receivedfrom")

Yes, I apologize for having steered you wrong.  After some further
investigation, the approach I mentioned will work for other clients, but
not for JDBC.  The postgresql JDBC driver does a SET client_encoding =
'UNICODE' when it first starts up which overwrites any default value
assigned to a user or database.  The paradigm it seems to be working with
is that anything Java based should be working with Unicode data only, and
it will let the backend do the encoding conversion between Unicode and the
server encoding.  This means you need to alter your code to convert from
Big5 to Unicode to work with this system although I'm not sure what the
best way to do this is.

You mentioned that this was a jsp application, what is the default
character encoding for the application server?  Does adjusting that help?

Kris Jurka



pgsql-jdbc by date:

Previous
From: "Renaud Waldura"
Date:
Subject: PostgreSQL & TopLink
Next
From: "dragos"
Date:
Subject: java object store