diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-04-07 10:11:41 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-07 10:11:41 +0200 |
commit | 5b8a043bf51ab8bcf4a758d0b4646f30a84be183 (patch) | |
tree | 9b620d5e8280d70f3787e35fc60cb845409559fe /tests/backends | |
parent | 73cbb372baa45d1fdafd571e2f430a980831f722 (diff) | |
download | django-5b8a043bf51ab8bcf4a758d0b4646f30a84be183.tar.gz |
Fixed #34470 -- Enforced UTF-8 encoding on PostgreSQL.
Regression in 6a2165816394ab4bb259f6171e82417e098e97a6.
Diffstat (limited to 'tests/backends')
-rw-r--r-- | tests/backends/postgresql/tests.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/backends/postgresql/tests.py b/tests/backends/postgresql/tests.py index 5589daa0c2..9c4512be24 100644 --- a/tests/backends/postgresql/tests.py +++ b/tests/backends/postgresql/tests.py @@ -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,)) |