Skip to content

Commit 6e7baa1

Browse files
author
James William Pye
committed
Merge commit 'v0.8.0'; branch 'v0.8'
2 parents ded23d4 + 74b8853 commit 6e7baa1

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

postgresql/documentation/changes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
Changes
77
=======
88
9+
0.8.1
10+
-----
11+
12+
* Fix encoding normalization.
13+
914
0.8.0 released on 2009-04-03
1015
----------------------------
1116

postgresql/encodings/aliases.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
# dictionary of Postgres encoding names to Python encoding names
1010
postgres_to_python = {
11-
'UNICODE' : 'utf_8',
1211
'unicode' : 'utf_8',
1312
'sql_ascii' : 'ascii',
1413
'euc_jp' : 'eucjp',

postgresql/protocol/typio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,8 +746,8 @@ def type_from_oid(self, oid):
746746
return typ
747747

748748
def set_encoding(self, value):
749-
self.encoding = value.lower()
750-
enc = pg_enc_aliases.postgres_to_python.get(value, value)
749+
self.encoding = value.lower().strip()
750+
enc = pg_enc_aliases.postgres_to_python.get(self.encoding, value)
751751
ci = codecs.lookup(enc)
752752
self._encode = ci[0]
753753
self._decode = ci[1]

postgresql/test/test_connect.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,18 @@ def initialize_database(self):
7272
"""
7373
)
7474

75+
def test_pg_open_SQL_ASCII(self):
76+
# postgresql.open
77+
host, port = self.cluster.address()
78+
# test simple locators..
79+
with pg_open(
80+
'pq://' + 'md5:' + 'md5_password@' + host + ':' + str(port) \
81+
+ '/test?client_encoding=SQL_ASCII'
82+
) as db:
83+
self.failUnlessEqual(db.prepare('select 1')(), [(1,)])
84+
self.failUnlessEqual(db.settings['client_encoding'], 'SQL_ASCII')
85+
self.failUnless(db.closed)
86+
7587
def test_pg_open(self):
7688
# postgresql.open
7789
host, port = self.cluster.address()

0 commit comments

Comments
 (0)