Re: Escaped backslash in SQL constant

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "CN" <cnliou9(at)fastmail(dot)fm>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Escaped backslash in SQL constant
Date: 2005-12-24 04:24:43
Message-ID: 12300.1135398283@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"CN" <cnliou9(at)fastmail(dot)fm> writes:
> INSERT INTO y VALUES ('y\134na');
> --"y\" and "na" are two Big5 characters.

I'm not sure how to explain it any more clearly: the backslash in this
example is not a backslash. It's a byte within a multibyte character,
which *entirely coincidentally* happens to have the same numeric value
as an ASCII backslash. But it isn't a backslash. And it won't be
processed as a backslash by any Big5-aware code.

Code that does not understand about multibyte characters is simply
unsafe to apply to data that is in Big5. You need to fix that
middleware to understand Big5 encoding; or if that seems impractical,
switch to using another encoding for the data the middleware sees.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message CN 2005-12-24 05:52:18 Re: Escaped backslash in SQL constant
Previous Message CN 2005-12-24 04:14:19 Re: Escaped backslash in SQL constant