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

From Eric Tan
Subject Re: How to insert Chinese (big5) through JDBC?
Date
Msg-id 20030804005913.53807.qmail@web13006.mail.yahoo.com
Whole thread Raw
In response to Re: How to insert Chinese (big5) through JDBC?  (Kris Jurka <books@ejurka.com>)
List pgsql-jdbc
Thank you very much. Kris Jurka.
I'm now understand !
 
I will change the connection bean. Add the line required there.
 
You mentioned client_encoding works for some clients. What are they?
 
Or can I change JDBC driver ? Where is the "set client_encoding" in JDBC ?
 
Best Regards,
  neltan

Kris Jurka <books@ejurka.com> wrote:


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



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

最新鈴聲推介:十面埋伏,多謝失戀,心淡...
http://ringtone.yahoo.com.hk

pgsql-jdbc by date:

Previous
From: Jesus Sandoval
Date:
Subject: Re: Server side resultset search (for performance reasons)
Next
From: "Renaud Waldura"
Date:
Subject: PostgreSQL & TopLink