RE: How to read/write multibyte to database - Mailing list pgsql-general

From Tatsuo Ishii
Subject RE: How to read/write multibyte to database
Date
Msg-id 20010315211552H.t-ishii@sra.co.jp
Whole thread Raw
In response to RE: How to read/write multibyte to database  (Tatsuo Ishii <t-ishii@sra.co.jp>)
List pgsql-general
> 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@sra.co.jp]
> Sent: Saturday, March 10, 2001 8:39 AM
> To: jklcom@mindspring.com
> Cc: pgsql-general@postgresql.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

pgsql-general by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: shared memory settings: SHMMAX and SHMALL
Next
From: "Russell Hires"
Date:
Subject: Re: Fw: Please Help