RE: How to read/write multibyte to database

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: jklcom(at)mindspring(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: RE: How to read/write multibyte to database
Date: 2001-03-16 01:24:43
Message-ID: 20010316102443J.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

From: "Jeff Lu" <jklcom(at)mindspring(dot)com>
Subject: RE: [GENERAL] How to read/write multibyte to database
Date: Thu, 15 Mar 2001 11:18:29 -0500
Message-ID: <NDBBIHPECLIGKCCLMACAMEJACLAA(dot)jklcom(at)mindspring(dot)com>

> Another question:
>
> What if the input data stream is mixture of English & Chinese such as
>
> How are you? = §A ¦n ¶Ü ¡H
>
> How should I handle this?

You mean ascii by "English"? Then it's ok since ascii chars always
lower than 0x80.

> -----Original Message-----
> From: Tatsuo Ishii [mailto:t-ishii(at)sra(dot)co(dot)jp]
> Sent: Thursday, March 15, 2001 7:16 AM
> To: jklcom(at)mindspring(dot)com
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: RE: [GENERAL] How to read/write multibyte to database
>
>
> > Can you please tell me what I need to do in my program to treat BIG5 such
> > that it will not conflict with ASCII escape sequence?
>
> Probably splitword and unescape_url need to rework, I'm not sure
> actualy what you are doing inside them though. For example, if you
> need to find '&', you would do like this:
>
> unsigned char *p = your_string_to_parse;
> int len = strlen(p);
> while (len > 0)
> {
> if (*p == '&')
> break;
> if (p > 0x7f) /* first byte of BIG5 ? */
> {
> p++; /* skip second byte */
> len--;
> }
> p++;
> len--;
> }
>
> > Thanks
> >
> > -----Original Message-----
> > From: Tatsuo Ishii [mailto:t-ishii(at)sra(dot)co(dot)jp]
> > Sent: Saturday, March 10, 2001 8:39 AM
> > To: jklcom(at)mindspring(dot)com
> > Cc: pgsql-general(at)postgresql(dot)org
> > Subject: RE: [GENERAL] How to read/write multibyte to database
> >
> >
> > > I'm using BIG5
> >
> > Then you lose. Because BIG5 containts byte patterns conflicting with
> > ASCII special charcters (like '\'), I guess your code:
> >
> > for(i=0; *queryString; i++)
> > {
> > splitword(items.Item, queryString, '&');
> > unescape_url(items.Item);
> > splitword(items.name, items.Item, '=');
> >
> > if(!strcmp(items.name, "Name"))
> > {
> > strcpy(name, items.Item);
> > }
> > else if(!strcmp(items.name, "Address"))
> > {
> > strcpy(address, items.Item);
> > }
> >
> > won't work. Change your program to treat BIG5 carefully. Or you
> > probably better to use EUC_TW or UTF-8 to write your web contents.
> > --
> > Tatsuo Ishii

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2001-03-16 01:24:51 RE: How to read/write multibyte to database
Previous Message Alex Howansky 2001-03-15 23:05:59 error logging