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 1m3fk5-0007g4-Nd for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Jul 2021 14:20:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1m3fk3-0001AN-Fa for pgsql-bugs@arkaria.postgresql.org; Wed, 14 Jul 2021 14:20:03 +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 1m3fk3-0001AF-8r for pgsql-bugs@lists.postgresql.org; Wed, 14 Jul 2021 14:20:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m3fk0-0005in-Vu for pgsql-bugs@lists.postgresql.org; Wed, 14 Jul 2021 14:20:02 +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 16EEJxor3484084; Wed, 14 Jul 2021 10:19:59 -0400 From: Tom Lane To: Julien Rouhaud cc: Antoine , pgsql-bugs@lists.postgresql.org Subject: Re: Windows locale cause server to send invalid data encoding to client In-reply-to: <20210714135052.bg5ywhl7p23tnjmg@nol> References: <20210714135052.bg5ywhl7p23tnjmg@nol> Comments: In-reply-to Julien Rouhaud message dated "Wed, 14 Jul 2021 21:50:52 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <3484082.1626272399.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 14 Jul 2021 10:19:59 -0400 Message-ID: <3484083.1626272399@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Julien Rouhaud writes: > On Wed, Jul 14, 2021 at 01:49:24PM +0200, Antoine wrote: >> I set up a postgresql server on Windows 10 and connected it using Rust,= but >> the Rust client reports invalid UTF-8 data when the password is wrong. = I >> use a french locale windows that contain some accents "=C3=A9=C3=A8=C3=AA= " etc. > This is unfortunately working as designed. The client encoding can't be= set > during startup (and authentication is part of it), see > https://github.com/postgres/postgres/blob/master/src/backend/utils/mb/mb= utils.c#L85-L88 > for more details about it: It seems like the core problem is that the "authentication failed" error text may be sent in an unexpected encoding. I wonder if we should decline to translate any error messages until we've established the requested client encoding. Sending the message in English isn't ideal either, but it'd avoid this hazard. regards, tom lane