Re: [HACKERS] Re: COPY doesn't works when containing ' ' or ' ' characters on db

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us
Cc: olly(at)lfix(dot)co(dot)uk, teixi(at)6tems(dot)com, pgsql-hackers(at)postgresql(dot)org, pgsql-admin(at)postgresql(dot)org, rickspam(at)wavedivision(dot)com, schweinsaug(at)crosswinds(dot)net
Subject: Re: [HACKERS] Re: COPY doesn't works when containing ' ' or ' ' characters on db
Date: 2001-02-28 01:01:34
Message-ID: 20010228100134Q.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-hackers

> "Oliver Elphick" <olly(at)lfix(dot)co(dot)uk> writes:
> > I think this happens when the front-end encoding is SQL_ASCII and the
> > database is using UNICODE. Then, there are misunderstandings between
> > front-end and back-end, so that a single character with the eighth bit
> > set may be sent by the front-end and interpreted by the back-end as the
> > first half of a UNICODE two-byte character.
>
> I wondered about that, but his examples had one or more characters
> between the eighth-bit-set character and the '|', so this doesn't seem
> to explain the problem.

No.

From Jaume's example:

> SELECT edicion FROM products;
> edicion
> -----------------
> Espaa|Nacional <-------puts on the same cell either there's an '|' in
> the middle!!!

\361 == 0xf1. UTF-8 assumes that:

if (the first byte) & 0xe0 == 0xe0, then the letter consists of 3
bytes.

So PostgreSQL believes that "a|" is one UTF-8 letter and eat up
'|'.

My guess is Jaume made an UNICODE database but provided it ISO 8859-1
or that kind of single-byte latin encoding data.

I'm wondering why so many people are using UTF-8 database even he does
not understand what UTF-8 is:-) I hope 7.1 would solve this kind of
confusion by enabling an automatic encoding conversion between UTF-8
and others.
--
Tatsuo Ishii

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Enrico Mangano 2001-02-28 09:09:11
Previous Message Tom Lane 2001-02-27 22:29:10 Re: pg_hba.conf changes have no effect on cygwin/NT 4.0

Browse pgsql-hackers by date

  From Date Subject
Next Message Rainer Mager 2001-02-28 01:14:48 RE: Problem with 7.0.3 dump -> 7.1b4 restore
Previous Message Hiroshi Inoue 2001-02-27 23:53:31 Re: [ODBC] Re: Release in 2 weeks ...