From: | Julien Rouhaud <rjuju123(at)gmail(dot)com> |
---|---|
To: | Antoine <plaskowski(dot)stanislas(at)gmail(dot)com> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: Windows locale cause server to send invalid data encoding to client |
Date: | 2021-07-14 13:50:52 |
Message-ID: | 20210714135052.bg5ywhl7p23tnjmg@nol |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
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 "éèê" etc.
>
> Windows use WTF-16 <https://simonsapin.github.io/wtf-8/> but the Rust
> client asks UTF-8 to the serveur so we think it's a bug from the server to
> not send UTF-8 even if Windows doesn't use it for its locale translation.
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/mbutils.c#L85-L88
for more details about it:
> /*
> * During backend startup we can't set client encoding because we (a)
> * can't look up the conversion functions, and (b) may not know the database
> * encoding yet either. So SetClientEncoding() just accepts anything and
> * remembers it for InitializeClientEncoding() to apply later.
> */
The driver should be prepared to receive non UTF-8 messages until
authentication succeeded.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2021-07-14 14:19:59 | Re: Windows locale cause server to send invalid data encoding to client |
Previous Message | Antoine | 2021-07-14 11:49:24 | Windows locale cause server to send invalid data encoding to client |