Re: Windows locale cause server to send invalid data encoding to client

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Julien Rouhaud <rjuju123(at)gmail(dot)com>
Cc: Antoine <plaskowski(dot)stanislas(at)gmail(dot)com>, 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 14:19:59
Message-ID: 3484083.1626272399@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Julien Rouhaud <rjuju123(at)gmail(dot)com> 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 "éèê" 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/mbutils.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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Julien Rouhaud 2021-07-14 14:32:25 Re: Windows locale cause server to send invalid data encoding to client
Previous Message Julien Rouhaud 2021-07-14 13:50:52 Re: Windows locale cause server to send invalid data encoding to client