I tested any things today. I think the Problem is before Django. I created a virtual env and started python. Imported psygopg2 and used an easy sql statement (select * from table;). Below I post my Script and the returned Errors.
>>> import psycopg2
>>> conn = psycopg2.connect("dbname=test_db user=test_user password=password host=127.0.0.1")
>>> cur = conn.cursor()
>>> cur.execute("show server_encoding;")
>>> cur.fetchall()
[('SQL_ASCII',)]
>>> cur.execute("show client_encoding;")
>>> cur.fetchall()
[('SQL_ASCII',)]
>>> cur.execute("select * from tbl_kunde where id = 6837;")
>>> cur.fetchall()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 24: ordinal not in range(128)
>>> cur.execute("set client_encoding='LATIN1';")
>>> cur.execute("select * from tbl_kunde where id = 6837;")
>>> cur.fetchall()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 24: ordinal not in range(128)
The Database is in SQL_ASCII and the Data inside are stored in LATIN1. I know that this is a big problem, but we use a old application developed since 2000 and this is essential for running our business. My part is to redesign the Application (UI, Process, …). But I can’t change the old Data Model at the first time, because the old Application is running beside. Hope you have an idea for the errors. I think its not so difficult, but i have no more ideas.