Fixed #34470 -- Enforced UTF-8 encoding on PostgreSQL.

Regression in 6a21658163.
This commit is contained in:
Mariusz Felisiak 2023-04-07 10:11:41 +02:00 committed by GitHub
parent 73cbb372ba
commit 5b8a043bf5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -323,6 +323,18 @@ class Tests(TestCase):
finally:
new_connection.close()
def test_client_encoding_utf8_enforce(self):
new_connection = connection.copy()
new_connection.settings_dict["OPTIONS"]["client_encoding"] = "iso-8859-2"
try:
new_connection.connect()
if is_psycopg3:
self.assertEqual(new_connection.connection.info.encoding, "utf-8")
else:
self.assertEqual(new_connection.connection.encoding, "UTF8")
finally:
new_connection.close()
def _select(self, val):
with connection.cursor() as cursor:
cursor.execute("SELECT %s::text[]", (val,))