Re: libpq - characterset encoding error from selecting BYTEA

Tom Lane <[email protected]> Tue, 15 Mar 2016 09:57:11 -0400
Newsgroups gmane.comp.db.postgresql.interfaces
Message-ID <[email protected]>
CN <[email protected]> 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


-- 
Sent via pgsql-interfaces mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces