Re: Inserting Unicode into Postgre - Mailing list pgsql-general

From Tatsuo Ishii
Subject Re: Inserting Unicode into Postgre
Date
Msg-id 20010417161538B.t-ishii@sra.co.jp
Whole thread Raw
In response to Inserting Unicode into Postgre  ("Firestar" <theebh@yahoo.com>)
List pgsql-general
> I'm currently using PostgreSQL 7.0 on Solaris. My Java program receives
> strings in Big5
> encoding and will store them in PostgreSQL (via JDBC). However, the inserted
> strings become
> multiple '?' (question marks) instead everytime i do a insert command. And
> when i retrieve them,
> via JDBC, the string becomes those question marks.
>
> Is the problem due to the Unicode encoding that Java String uses, or must i
> enable multibyte-support
> in my postgre installation? If i enable multibyte support, should i create
> my table with Unicode support,
> or Big5?

First of all, you cannot store Big5 data into PostgreSQL. You need to
convert Big5 to either EUC_TW or UTF-8 before storing them into
PostgreSQL database. There are several ways to accompish this.

The easiest way would be upgrade to 7.1 with multibyte support enabled
and create a database with UNICODE (actially UTF-8) or EUC_TW
encoding. In this environment, 7.1's JDBC driver would recognize the
database encoding correctly, and do an automatic conversion between
database encodings and UTF-8, that is Java's internal encoding.

Ask Java expers on this list for more details.
--
Tatsuo Ishii


pgsql-general by date:

Previous
From: Anand Raman
Date:
Subject: Re: Cursors in plpgsql
Next
From: "Oliver Elphick"
Date:
Subject: Re: join queries