The first database I tried connecting to with pg8000 uses SQL_ASCII for the default encoding. The string 'SQL_ASCII' ends up being passed directly to unicode() as client_encoding, resulting in the following traceback:
>>> db = pg8000.Connection(host='localhost', user='pgsql', database='testdb', port=5435)
>>> cursor = pg8000.Cursor(db)
>>> cursor.execute("select label from tbl_test")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "pg8000.py", line 607, in execute
self._stmt.execute(*args)
File "pg8000.py", line 493, in execute
self._fill_cache()
File "pg8000.py", line 502, in _fill_cache
end_of_data, rows = self.c.fetch_rows(self._portal_name, self.row_cache_size, self._row_desc)
File "pg8000.py", line 1277, in fetch_rows
rows.append(
File "pg8000.py", line 1470, in py_value
return func(v, **kwargs)
File "pg8000.py", line 1543, in varcharin
return unicode(data, client_encoding)
LookupError: unknown encoding: SQL_ASCII
I'm using version 1.02.