Re: How to insert Chinese (big5) through JDBC?

Поиск
Список
Период
Сортировка
От Kris Jurka
Тема Re: How to insert Chinese (big5) through JDBC?
Дата
Msg-id Pine.LNX.4.33.0308020617450.10101-100000@leary.csoft.net
обсуждение исходный текст
Ответ на Re: How to insert Chinese (big5) through JDBC?  (Eric Tan <neltan2002@yahoo.com.hk>)
Ответы Re: How to insert Chinese (big5) through JDBC?
Список 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 по дате отправления:

Предыдущее
От: "Renaud Waldura"
Дата:
Сообщение: PostgreSQL & TopLink
Следующее
От: "dragos"
Дата:
Сообщение: java object store