Re: Escaped backslash in SQL constant - Mailing list pgsql-general

From Tom Lane
Subject Re: Escaped backslash in SQL constant
Date
Msg-id 12300.1135398283@sss.pgh.pa.us
Whole thread Raw
In response to Re: Escaped backslash in SQL constant  ("CN" <cnliou9@fastmail.fm>)
Responses Re: Escaped backslash in SQL constant
List pgsql-general
"CN" <cnliou9@fastmail.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

pgsql-general by date:

Previous
From: "CN"
Date:
Subject: Re: Escaped backslash in SQL constant
Next
From: "CN"
Date:
Subject: Re: Escaped backslash in SQL constant