Thread: Re: Multibyte examples

Re: Multibyte examples

From
Tatsuo Ishii
Date:
From: "Jeff Lu" <jklcom@mindspring.com>
Subject: Multibyte examples
Date: Tue, 20 Mar 2001 12:38:26 -0500
Message-ID: <NDBBIHPECLIGKCCLMACAEEPDCJAA.jklcom@mindspring.com>

> Tatsuo Ishii
> 
> I've finally got the envirnoment set up to work with PostgreSQL, cygwin on
> NT
> 
> Couldn't the regression test to run.
> 
> When tried
> % mbregress.sh
> 
> I got lots of errors

What kind of errors did you get exactly?

> I want to see some examples on multibytes.
> I'm trying to write a CGI program that will gather user info from a form
> through HTTP Request. The information may contain Chinese Characters.  The
> result will be written to PostgreSQL.
> 
> Do you have any examples like this?

I'm not sure what kind of encodings you are talking about when you say
"Chinese Chinese". Anyway you will find some examples:

Big5:     src/test/mb/big5.sql
EUC_CN:     src/test/mb/euc_cn.sql
EUC_TW:     src/test/mb/euc_tw.sql
--
Tatsuo Ishii


RE: Multibyte examples

From
Tatsuo Ishii
Date:
From: "Jeff Lu" <jklcom@mindspring.com>
Subject: RE: Multibyte examples
Date: Tue, 20 Mar 2001 22:17:39 -0500
Message-ID: <NDBBIHPECLIGKCCLMACACEPMCJAA.jklcom@mindspring.com>

> Please excuse my ignorance in PostgreSQL for I'm new to this.
> 
> This is what I got when tried to run mbregress.sh, what am I missing?
> 
> destroydb: not found
> destroydb: not found
> /usr/local/pgsql/bin/pg_encoding: not found
> destroydb: not found
> destroydb: not found
[snip]

It is likely your PostgreSQL installation or your personal environment
settings are not correct. Please read the INSTALL doc carefully and
try again.

> I looked in the examples such as
> Big5:     src/test/mb/big5.sql
> EUC_CN:     src/test/mb/euc_cn.sql
> EUC_TW:     src/test/mb/euc_tw.sql
> 
> 
> Are these files excutable?

No. These are just SQL files. You can execute them like:

psql -e -f src/test/mb/big5.sql your_database_name

> I want to see some examples using C API to
> read/write to database using Big5 encoding.  I'm just not sure what to do
> before writing the data to the database.  Do I need to do any conversion?

There are C examples somewhere under the source tree.

To use Big5 in frontend side, you just set an environment variable
called "PGCLIENTENCODING" to "Big5". Note that PostgreSQL 7.0.x has
bugs thus it will not work with this feature. Grab
ftp://ftp.sra.co.jp/pub/cmd/postgres/7.0.3/patches/libpq.patch.gz and
apply it. Or you could use 7.1 beta.
--
Tatsuo Ishii



Re: RE: Multibyte examples

From
Tom Lane
Date:
>> This is what I got when tried to run mbregress.sh, what am I missing?
>> 
>> destroydb: not found

Hm.  destroydb was renamed to dropdb a release or two back, but it seems
mbregress.sh hasn't gotten the word yet.

>> /usr/local/pgsql/bin/pg_encoding: not found

This is a little more troubling.  Did you configure the system with
multibyte support enabled?  pg_encoding should have been created and
installed if so.
        regards, tom lane


Re: RE: Multibyte examples

From
Tatsuo Ishii
Date:
> >> This is what I got when tried to run mbregress.sh, what am I missing?
> >> 
> >> destroydb: not found
> 
> Hm.  destroydb was renamed to dropdb a release or two back, but it seems
> mbregress.sh hasn't gotten the word yet.

Good point. I didn't realize it. Will fix.
--
Tatsuo Ishii