Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXCAH-003TXW-1m for pgsql-general@arkaria.postgresql.org; Sun, 21 Dec 2025 05:39:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vXCAF-00BBCA-1i for pgsql-general@arkaria.postgresql.org; Sun, 21 Dec 2025 05:39:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXCAF-00BBC2-0d for pgsql-general@lists.postgresql.org; Sun, 21 Dec 2025 05:39:31 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXCAD-001rmx-0t for pgsql-general@lists.postgresql.org; Sun, 21 Dec 2025 05:39:31 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5BL5dNhN061122; Sun, 21 Dec 2025 00:39:23 -0500 From: Tom Lane To: Igor Korot cc: Laurenz Albe , "pgsql-generallists.postgresql.org" Subject: Re: PQexecPrepared() question In-reply-to: References: <2547700.1765940917@sss.pgh.pa.us> <9a0ce31a49f149d8d982d2b359095560655f781e.camel@cybertec.at> <852dee881b6cc82b9d4b51d69d48c415e2a87b4d.camel@cybertec.at> Comments: In-reply-to Igor Korot message dated "Sat, 20 Dec 2025 21:33:23 -0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <61120.1766295563.1@sss.pgh.pa.us> Date: Sun, 21 Dec 2025 00:39:23 -0500 Message-ID: <61121.1766295563@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Igor Korot writes: > I added the following code in my app: > res = PQexec( m_db, "SHOW client_encoding" ); > auto value = PQgetvalue( res, 0, 0 ); > PQclear( res ); > and the value of the "value" variable is "UTF8". Okay ... > The exact error message is: > ERROR: invalid byte sequence for encoding UTF8: 0xdf > CONTEXT: unnamed portal parameter $1 > on the INSERT. client_encoding governs both the encoding that the server will send, and the encoding that it expects to receive. You are sending a parameter string that is not valid UTF8. regards, tom lane