> > That's because none-MB client does not understand how "Shift JIS
> > kanji" consists of letters with different width bytes. The similar
> > problem would happen with the Big5 character set (traditional
> > Chinese), also. Unlike other character sets, these should be treated
> > carefully since they include the same bit patterns as ASCII and that
> > makes none-MB clients confused.
> 
> I'm confused though, this would mean that somewhere in the string
> `SJIS_KANJI' a backslash was found. But that's all ASCII characters.
> Aren't the characters 0-127 always identical in any character set?

Not always. Shift JIS and Big5 include 0-127 characters. So "how to
distinguish them from ASCII?", you might ask. Here are rules for this:

1. parse from the begining byte of the string in question. If it is
0-127 then it's an ASCII (single byte letter).

2. if it's between 0xa1 and 0xdf, it's a "1 byte kana" (single byte
letter).

3. otherwise it's a "kanji" (double byte letter). In this case the
second byte might be in range of 0-127 (this is the source of the
problem).

I think Big5 has similar, but a little bit different rule (I don't
remember precisely now).

Other encodings having 0-127 range bytes (but they are not ASCII)
include:

o UCS-2, 4 (Unicode)

o any 7 bit encoded ISO 2022 based charsets. for example, ISO 2022-jp.
--
Tatsuo Ishii

Fri, 05 May 2000 19:36:18 +0900
Tatsuo Ishii <t-ishii@sra.co.jp>
Re: client libpq multibyte support 

Tatsuo Ishii <t-ishii@sra.co.jp> wrote:

> > >  admin=# select * from SJIS_KANJI ;
> > >  \: extra argument ';' ignored
> > >  \: extra argument ';' ignored
> > >  Invalid command \. Try \? for help.        
> >
(snip)
> 
> That's because none-MB client does not understand how "Shift JIS
> kanji" consists of letters with different width bytes. The similar
> problem would happen with the Big5 character set (traditional
> Chinese), also. Unlike other character sets, these should be treated
> carefully since they include the same bit patterns as ASCII and that
> makes none-MB clients confused.

  Thank you for your reply.

(Probably, the direct cause of this error is PQmblen(). non-
 MULTIBYTE-PQmblen() always return "1". )


>             Anyway, I could hardly imagine that such configurations
> would actually exist in the real world.  Masaaki, could you tell me
> what are the advantages or reasons of the configuration?

# My poor English won't be able to explain the real world ;-).

  If a client libpq always be made by "configure --enable-
multibute",  the advantages are 

  1. In the case of SQL_ASCII,  a client application speed is 
     almost equal to non-MULTIBYTE. And the MULTIBYTE code is 
     not so larger.
  2. When required, by using "set client_encoding=xxx", it is 
     possible to use the MULTIBYTE at any time.


--
Regard,
SAKAIDA Masaaki -- Osaka, Japan

Sat, 06 May 2000 01:06:26 +0900
SAKAIDA Masaaki <sakaida@psn.co.jp>
Re: client libpq multibyte support 