public inbox for [email protected]
help / color / mirror / Atom feedFrom: Daniele Varrazzo <[email protected]>
To: Karl O. Pinc <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Reporting UnicodeEncodeError info on arbitrary data sent to PG with psycopg3
Date: Wed, 14 Feb 2024 19:28:57 +0100
Message-ID: <CA+mi_8bKxi286PjqYrt9Epcd2dxL+vFtMDJuyurV2edsOEMqJg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
<CA+mi_8Y0jzEZA+3kCnTtWCS8cvWTUFcD=0J+ihiamh=y8GvOxg@mail.gmail.com>
<[email protected]>
Hello,
On Wed, 14 Feb 2024 at 16:42, Karl O. Pinc <[email protected]> wrote:
> I did not use conn.info.encoding because the docs say that it
> contains the _client_ encoding, not the server-side encoding
> used to store the db content.
> [...]
> Confirming the encodings, connecting to the "latin1" db with psql shows:
> kop_latin1=> show client_encoding;
> UTF8
>
> kop_latin1=> show server_encoding;
> LATIN1
>
> But, conn.info.encoding does return iso8859-1.
>
> So I think your documentation has confused client
> and server in this case. If you can confirm this
> for me I'll go ahead and use conn.info.encoding.
No, I am pretty sure that this is the client encoding that is
reported. It comes from here:
https://github.com/psycopg/psycopg/blob/ef6941df5b94997f79b429347c5d9b84e600bdd3/psycopg/psycopg/_en...
which is a wrapper for PQparameterStatus:
https://www.postgresql.org/docs/current/libpq-status.html#LIBPQ-PQPARAMETERSTATUS
(so that the setting can be retrieved without running a query).
Maybe the way you are connecting via psql sets the client_encoding?
Can you try to get the result of `SHOW client_encoding` from psycopg?
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected]
Subject: Re: Reporting UnicodeEncodeError info on arbitrary data sent to PG with psycopg3
In-Reply-To: <CA+mi_8bKxi286PjqYrt9Epcd2dxL+vFtMDJuyurV2edsOEMqJg@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox