From: dvarrazzo (@dvarrazzo) <noreply+dvarrazzo@github.com>
To: psycopg/psycopg <noreply+psycopg-psycopg@github.com>
Subject: Re: [psycopg/psycopg] PR #1505: Decode JSON data using the connection encoding
Date: Thu, 19 Nov 2026 18:00:18 +0000
Message-ID: <gh-psycopg-psycopg-1505-c7017540613@github.com> (raw)
In-Reply-To: <gh-psycopg-psycopg-1505@github.com>
References: <gh-psycopg-psycopg-1505@github.com>
@anish-yen also could you please add a test with the 'ascii' encoding? Note that 'ascii' in postgres means no encoding, so, for example, the text loader will return bytes instead of str.
I guess you should create a table and put in a value with a non-ascii char when the connection is in utf8, then switch it to ascii, read the data, and see what comes out.
My fear is that the result might depend on the database encoding, but maybe that's not the case and we receive utf8 which we can easily decode. It would be good if there was a test in the test suite though.