public inbox for [email protected]  
help / color / mirror / Atom feed
client_encoding is WIN1252 on ErrorMessage at the StartupMessage
9+ messages / 2 participants
[nested] [flat]

* client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-09 01:23  Jean-Yves Garneau <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Jean-Yves Garneau @ 2023-12-09 01:23 UTC (permalink / raw)
  To: 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,


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-09 01:30  Tom Lane <[email protected]>
  parent: Jean-Yves Garneau <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2023-12-09 01:30 UTC (permalink / raw)
  To: Jean-Yves Garneau <[email protected]>; +Cc: pgsql-interfaces

Jean-Yves Garneau <[email protected]> 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





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 12:07  Jean-Yves Garneau <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Jean-Yves Garneau @ 2023-12-11 12:07 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: 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



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 14:51  Tom Lane <[email protected]>
  parent: Jean-Yves Garneau <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2023-12-11 14:51 UTC (permalink / raw)
  To: Jean-Yves Garneau <[email protected]>; +Cc: pgsql-interfaces

Jean-Yves Garneau <[email protected]> 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





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 16:07  Jean-Yves Garneau <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Jean-Yves Garneau @ 2023-12-11 16:07 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: pgsql-interfaces

French_Canada.1252


^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 16:14  Tom Lane <[email protected]>
  parent: Jean-Yves Garneau <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2023-12-11 16:14 UTC (permalink / raw)
  To: Jean-Yves Garneau <[email protected]>; +Cc: pgsql-interfaces

Jean-Yves Garneau <[email protected]> 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





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 17:02  Jean-Yves Garneau <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Jean-Yves Garneau @ 2023-12-11 17:02 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: 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.



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 17:06  Tom Lane <[email protected]>
  parent: Jean-Yves Garneau <[email protected]>
  0 siblings, 1 reply; 9+ messages in thread

From: Tom Lane @ 2023-12-11 17:06 UTC (permalink / raw)
  To: Jean-Yves Garneau <[email protected]>; +Cc: pgsql-interfaces

Jean-Yves Garneau <[email protected]> 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





^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* RE: client_encoding is WIN1252 on ErrorMessage at the StartupMessage
@ 2023-12-11 17:51  Jean-Yves Garneau <[email protected]>
  parent: Tom Lane <[email protected]>
  0 siblings, 0 replies; 9+ messages in thread

From: Jean-Yves Garneau @ 2023-12-11 17:51 UTC (permalink / raw)
  To: Tom Lane <[email protected]>; +Cc: pgsql-interfaces

Thank you Tom.


^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2023-12-11 17:51 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-12-09 01:23 client_encoding is WIN1252 on ErrorMessage at the StartupMessage Jean-Yves Garneau <[email protected]>
2023-12-09 01:30 ` Tom Lane <[email protected]>
2023-12-11 12:07   ` Jean-Yves Garneau <[email protected]>
2023-12-11 14:51     ` Tom Lane <[email protected]>
2023-12-11 16:07       ` Jean-Yves Garneau <[email protected]>
2023-12-11 16:14         ` Tom Lane <[email protected]>
2023-12-11 17:02           ` Jean-Yves Garneau <[email protected]>
2023-12-11 17:06             ` Tom Lane <[email protected]>
2023-12-11 17:51               ` Jean-Yves Garneau <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox