RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage

Lists: pgsql-interfaces
From: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
To: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-09 01:23:01
Message-ID: YQBPR0101MB453883F750587BB0EF9B6738FF89A@YQBPR0101MB4538.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

I'm developing the wire protocol on programmable logic controller (PLC) to communicate with the backend server.
The PostgreSQL server run on Windows 10 French Canadian.
The client_encoding on the server and database encoding is UTF8.
The collation and character type are French_Canada.1252.
The PLC is UTF8.
After TCP/IP connection, the PLC send the "StartupMessage" but receive an "ErrorResponse" because no access right.
The error message is in WIN1252 not UTF8!
If grant connect access to user and get data from database all is UTF8!
Is it a bug or bad setup?

Regards,


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-09 01:30:43
Message-ID: 1571714.1702085443@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com> writes:
> I'm developing the wire protocol on programmable logic controller (PLC) to communicate with the backend server.
> The PostgreSQL server run on Windows 10 French Canadian.
> The client_encoding on the server and database encoding is UTF8.
> The collation and character type are French_Canada.1252.
> The PLC is UTF8.
> After TCP/IP connection, the PLC send the "StartupMessage" but receive an "ErrorResponse" because no access right.
> The error message is in WIN1252 not UTF8!
> If grant connect access to user and get data from database all is UTF8!
> Is it a bug or bad setup?

Bad setup, I'd say. If you have a connection failure before the backend
has joined a particular database, it won't have adopted any database-level
encoding or locale; moreover I don't think it's capable of doing encoding
translation at that point. So any such messages are going to be sent with
encoding matching the postmaster process's native locale, which you seem
to have chosen more or less at random. If you have a global expectation
about what encoding to use, best make the postmaster's startup locale
settings match that.

regards, tom lane


From: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 12:07:46
Message-ID: YQBPR0101MB45381E17BAEDA51A6760BFA5FF8FA@YQBPR0101MB4538.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Dear Tom,

For me UTF8 is the choice and I used :
* client_encoding = UTF8
* server_encoding = UTF8

Is there another encoding variable to setup?

Regards,
Jean-Yves Garneau


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 14:51:56
Message-ID: 2169859.1702306316@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com> writes:
> Dear Tom,
> For me UTF8 is the choice and I used :
> * client_encoding = UTF8
> * server_encoding = UTF8

> Is there another encoding variable to setup?

What's lc_messages set to (in postgresql.conf)?

regards, tom lane


From: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 16:07:07
Message-ID: YQBPR0101MB45381D6E7D5A3224BF63AC2BFF8FA@YQBPR0101MB4538.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

French_Canada.1252


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 16:14:00
Message-ID: 2249117.1702311240@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com> writes:
> French_Canada.1252

That's where your WIN1252 is coming from, then. You need to make
that be something utf-8-based.

regards, tom lane


From: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 17:02:32
Message-ID: YQBPR0101MB4538A49B5DF96E765E9BD7C7FF8FA@YQBPR0101MB4538.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

I replaced the lc_messages to 'UTF8' but received the error response in English.
I replaced the lc_messages to 'French_Canada.UTF8' but received the error response in 1252.


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 17:06:13
Message-ID: 2287032.1702314373@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com> writes:
> I replaced the lc_messages to 'UTF8' but received the error response in English.
> I replaced the lc_messages to 'French_Canada.UTF8' but received the error response in 1252.

Sorry, I don't know much about how Windows locales work. You may
have to mess with something like the code page environment in which
the postmaster is started.

regards, tom lane


From: Jean-Yves Garneau <Jean-Yves(dot)Garneau(at)invest-quebec(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-interfaces(at)postgresql(dot)org" <pgsql-interfaces(at)postgresql(dot)org>
Subject: RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
Date: 2023-12-11 17:51:31
Message-ID: YQBPR0101MB4538C961361A947BA17B7295FF8FA@YQBPR0101MB4538.CANPRD01.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-interfaces

Thank you Tom.