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

From Tom Lane
Subject Re: Escaped backslash in SQL constant
Date
Msg-id 11235.1135388531@sss.pgh.pa.us
Whole thread Raw
In response to Escaped backslash in SQL constant  ("CN" <cnliou9@fastmail.fm>)
Responses Re: Escaped backslash in SQL constant
List pgsql-general
"CN" <cnliou9@fastmail.fm> writes:
> The database cluster is initialized to use UNICODE. The client encoding
> is set to BIG5. The middleware escapes the backslash in the following
> string before writing to TEXT/VARCHAR column in server:

> a5 5c af e0

Seems to me that you need to fix your broken middleware --- it has no
business doing that.

> This is a string comprises Big5 characters each of 2 octets big. Note
> that the second octets, 5c, of the first Big5 character clashes
> backslash '\'. Thus, this string is escaped to

> a5 5c 31 33 34 af e0

Now you have a 2-octet Big5 character, followed by 3 1-octet ASCII
digits, followed by a 2-octet Big5 character.  All the subsequent
processing is doing what it should with this, AFAICS.

            regards, tom lane

pgsql-general by date:

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