Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1afpTf-0001ks-Aq for pgsql-interfaces@arkaria.postgresql.org; Tue, 15 Mar 2016 13:57:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1afpTe-0000Br-TT for pgsql-interfaces@arkaria.postgresql.org; Tue, 15 Mar 2016 13:57:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1afpTK-0007sg-UZ for pgsql-interfaces@postgresql.org; Tue, 15 Mar 2016 13:57:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1afpTH-0007Un-Qh for pgsql-interfaces@postgresql.org; Tue, 15 Mar 2016 13:57:18 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u2FDvBgj018019; Tue, 15 Mar 2016 09:57:11 -0400 From: Tom Lane To: CN cc: pgsql-interfaces@postgresql.org Subject: Re: libpq - characterset encoding error from selecting BYTEA In-reply-to: <1458049871.2074609.549741642.32C1352A@webmail.messagingengine.com> References: <1458049871.2074609.549741642.32C1352A@webmail.messagingengine.com> Comments: In-reply-to CN message dated "Tue, 15 Mar 2016 21:51:11 +0800" Date: Tue, 15 Mar 2016 09:57:11 -0400 Message-ID: <18018.1458050231@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-interfaces Precedence: bulk Sender: pgsql-interfaces-owner@postgresql.org CN 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 (pgsql-interfaces@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-interfaces