Re: libpq - characterset encoding error from selecting BYTEA - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: libpq - characterset encoding error from selecting BYTEA
Date
Msg-id 18018.1458050231@sss.pgh.pa.us
Whole thread Raw
In response to libpq - characterset encoding error from selecting BYTEA  (CN <cnliou9@fastmail.fm>)
Responses Re: libpq - characterset encoding error from selecting BYTEA  (CN <cnliou9@fastmail.fm>)
List pgsql-interfaces
CN <cnliou9@fastmail.fm> writes:
> PGconn* first switches to "BIG5" client encoding:
> PQexec(conn,"SET CLIENT_ENCODING TO BIG5");

> version 1:

> const char *pValues[]={"5","6"};
> PGresult *r=PQexecParams(conn,"SELECT c3::BYTEA FROM t1 WHERE c1=$1 AND
> c2=$2",2,NULL,pValues,NULL,NULL,1);

> What is strange is that above PQexecParams() works in one portion of my
> program but in another portion it yields the following error:

> ERROR:  character with byte sequence 0x98 0xe1 in encoding "BIG5" has no
> equivalent in encoding "UTF8"

Given the way the complaint is phrased, the problem is with data going
*to* the server, not *from* the server.  I don't think the returned bytea
is your issue at all; it must be either in the SQL query string or the
parameter values being sent.  Probably you should review how you're
setting up the parameter strings.
        regards, tom lane



pgsql-interfaces by date:

Previous
From: CN
Date:
Subject: libpq - characterset encoding error from selecting BYTEA
Next
From: CN
Date:
Subject: Re: libpq - characterset encoding error from selecting BYTEA