Thread: Insert Unicode

Insert Unicode

From
"Anthony"
Date:
Hi all,

I have created a UNICODE database using the 7.2.1. But I am not sure how to
prepare an insert script to insert double byte unicode data (e.g. Chinese)
to the tables. I tried to run the script under PGAdminII and also psql
directly but always encounter problem say invalid UNICODe. Any escape
character required?

Anthony



Re: Insert Unicode

From
Tino Wildenhain
Date:
Hi,

--On Dienstag, 16. April 2002 14:23 +0800 Anthony <anthonykwok@writeme.com>
wrote:

> Hi all,
>
> I have created a UNICODE database using the 7.2.1. But I am not sure how
> to prepare an insert script to insert double byte unicode data (e.g.
> Chinese) to the tables. I tried to run the script under PGAdminII and
> also psql directly but always encounter problem say invalid UNICODe. Any
> escape character required?

If you run the database unicode, the default encoding is utf-8.
So either prepare your imports with that encoding or
switch the frontend-encoding with
set client_encoding to 'your-encoding-here'

Regards
Tino

Re: Insert Unicode

From
Jean-Michel POURE
Date:
Le Mardi 16 Avril 2002 08:23, Anthony a écrit :
> I have created a UNICODE database using the 7.2.1. But I am not sure how to
> prepare an insert script to insert double byte unicode data (e.g. Chinese)
> to the tables. I tried to run the script under PGAdminII and also psql
> directly but always encounter problem say invalid UNICODe. Any escape
> character required?

Dear Anthony,

pgAdmin2 is not multi-byte safe due to Visual Basic limitations.

On the converse, it is possible to use pgAdmin2 to design and manage a Unicode
database, provided that you automatically recode data client-side to a
supported charset (Latin9 for example as it support the euro symbol). Just
enter SET CLIENT_ENCODING = 'Latin9' in pgAdmin2 query editor.

To view Unicode data under Windows, the only solution is to :
- download and install the latest ODBC multi-byte driver from
http://odbc.postgresql.org
- use a unicode compliant application (ex : M$ Access2K).

Cheers,
Jean-Michel

Re: Insert Unicode

From
Jean-Michel POURE
Date:
Le Mercredi 17 Avril 2002 14:09, Anthony Kwok a écrit :
> I finally use a JDBC client to insert the data to the database. But I found
>  it is more convenient if we can insert the data directly using psql. Any
> way to specific the Unicode character just like Java using \u ?

I think \hexadecimal_value works. Unfortunately, Java Unicode notation is not
supported. This would be so easy...

Re: Insert Unicode

From
"Anthony Kwok"
Date:
I finally use a JDBC client to insert the data to the database. But I found  it is more convenient if we can insert the
datadirectly using psql. Any way to specific the Unicode character just like Java using \u ?
 

Anthony

> -----Original Message-----
> From: Jean-Michel POURE [mailto:jm.poure@freesurf.fr]
> Sent: Wednesday, April 17, 2002 5:28 PM
> To: Anthony; pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Insert Unicode
> 
> 
> Le Mardi 16 Avril 2002 08:23, Anthony a écrit :
> > I have created a UNICODE database using the 7.2.1. But I am not 
> sure how to
> > prepare an insert script to insert double byte unicode data 
> (e.g. Chinese)
> > to the tables. I tried to run the script under PGAdminII and also psql
> > directly but always encounter problem say invalid UNICODe. Any escape
> > character required?
> 
> Dear Anthony,
> 
> pgAdmin2 is not multi-byte safe due to Visual Basic limitations.
> 
> On the converse, it is possible to use pgAdmin2 to design and 
> manage a Unicode 
> database, provided that you automatically recode data client-side to a 
> supported charset (Latin9 for example as it support the euro 
> symbol). Just 
> enter SET CLIENT_ENCODING = 'Latin9' in pgAdmin2 query editor.
> 
> To view Unicode data under Windows, the only solution is to :
> - download and install the latest ODBC multi-byte driver from 
> http://odbc.postgresql.org
> - use a unicode compliant application (ex : M$ Access2K).
> 
> Cheers,
> Jean-Michel
>

Re: Insert Unicode

From
Jean-Michel POURE
Date:
Le Mercredi 17 Avril 2002 14:09, Anthony Kwok a écrit :
> I finally use a JDBC client to insert the data to the database. But I found
>  it is more convenient if we can insert the data directly using psql. Any
> way to specific the Unicode character just like Java using \u ?

Not that I know of. I would love to see this feature.
Cheers, Jean-Michel