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 01:42:11
Message-ID: 11235.1135388531@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"CN" <cnliou9(at)fastmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message CN 2005-12-24 03:20:25 Re: Escaped backslash in SQL constant
Previous Message CN 2005-12-24 01:31:21 Escaped backslash in SQL constant