Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW7Ud-0007wO-Iz for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 00:00:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jW7Ua-0001q3-40 for pgsql-general@arkaria.postgresql.org; Wed, 06 May 2020 00:00:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW7UZ-0001pw-Kd for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 00:00:51 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jW7UW-0003ln-Uz for pgsql-general@lists.postgresql.org; Wed, 06 May 2020 00:00:50 +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 04600llE001792; Tue, 5 May 2020 20:00:47 -0400 From: Tom Lane To: Christian Ramseyer cc: "pgsql-general@lists.postgresql.org" Subject: Re: Encoding conversion: Use replacement character instead of failing query with "ERROR: character with byte sequence 0xd0 0xad in encoding "UTF8" has no equivalent in encoding LATIN1" ? In-reply-to: <3c30a47a-09c8-8b36-3ebb-6336c0f089d6@networkz.ch> References: <3c30a47a-09c8-8b36-3ebb-6336c0f089d6@networkz.ch> Comments: In-reply-to Christian Ramseyer message dated "Wed, 06 May 2020 00:50:24 +0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1790.1588723247.1@sss.pgh.pa.us> Date: Tue, 05 May 2020 20:00:47 -0400 Message-ID: <1791.1588723247@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Christian Ramseyer writes: > Can I somehow influence the client:UTF8->server:LATIN1 character set > conversion so that instead of failing, it inserts an invalid codepoint > character, the utf8 hex bytes as string, drops the character or > something like that? There's nothing built-in for that, but it seems like it wouldn't be hard to modify the code if you wanted a quick hack to do this. In general, the system nominally supports multiple conversion functions per encoding pair, so you could imagine having an alternate conversion that doesn't throw errors. Problem is that it's quite difficult to get the system to actually *use* a non-default conversion for anything really significant, like say client I/O. I don't know that anyone's thought hard about how to improve that. regards, tom lane