Thread: Determine Client Encoding

Determine Client Encoding

From
Leonardo M. Ramé
Date:
Hi, we found characters with different enconding in our database. As our
system is accessed by many PCs I would like to know if it's possible to
know the encoding of each connection, without going to each PC to check
its connection string.

Regards,
--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877



Re: Determine Client Encoding

From
Tom Lane
Date:
Leonardo =?iso-8859-1?Q?M=2E_Ram=E9?= <l.rame@griensu.com> writes:
> Hi, we found characters with different enconding in our database. As our
> system is accessed by many PCs I would like to know if it's possible to
> know the encoding of each connection, without going to each PC to check
> its connection string.

If you mean can one session identify the client_encoding of another
session, no; that information isn't exposed anyplace.  Within a session,
you can of course use "show client_encoding" or various equivalent
syntaxes.

Note that when you have encoding problems, as often as not the issue
is that the data the client is sending isn't really in the encoding
its client_encoding setting claims.  So even if you could find that
out remotely, it probably wouldn't help localize the issue very well.

            regards, tom lane


Re: Determine Client Encoding

From
Leonardo M. Ramé
Date:
On 2014-02-26 09:48:12 -0500, Tom Lane wrote:
> Leonardo =?iso-8859-1?Q?M=2E_Ram=E9?= <l.rame@griensu.com> writes:
> > Hi, we found characters with different enconding in our database. As our
> > system is accessed by many PCs I would like to know if it's possible to
> > know the encoding of each connection, without going to each PC to check
> > its connection string.
>
> If you mean can one session identify the client_encoding of another
> session, no; that information isn't exposed anyplace.  Within a session,
> you can of course use "show client_encoding" or various equivalent
> syntaxes.
>
> Note that when you have encoding problems, as often as not the issue
> is that the data the client is sending isn't really in the encoding
> its client_encoding setting claims.  So even if you could find that
> out remotely, it probably wouldn't help localize the issue very well.
>
>             regards, tom lane

Thanks Tom, let me try to understand what you said.

For example if client_encoding is set to "win1252", but the user does a
copy-paste from MsWord (usually they do this), characters could have
been sent in utf8 ?.

If this is the case, the insert/update is done, but cannot be read from
another client. Right?.

Regards,
--
Leonardo M. Ramé
Medical IT - Griensu S.A.
Av. Colón 636 - Piso 8 Of. A
X5000EPT -- Córdoba
Tel.: +54(351)4246924 +54(351)4247788 +54(351)4247979 int. 19
Cel.: +54 9 (011) 40871877