Ich möchte ein Feld in SQL Server 2008 von Python 2.6 erhalten. Hier ist meine freetds Conf-Datei:UnicodeDecodeError bei Verwendung von Pymssql mit Freetds
[ARGSERVER03]
host = 192.168.1.3
port = 1433
tds version = 7.0
Hier ist der Code:
conn = pymssql.connect(host='192.168.1.3', user='****', password='****', database='TrafficMonitor', as_dict=True, charset='UTF-8')
i = 0
cur.execute('SELECT * FROM dbo.tblTrafficCounterData')
while i < 10:
car = cur.fetchone_asdict()
if car is None:
break
c = car['Class']
print c
i = i + 1
Aber es gibt:
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd3 in position 0: invalid continuation byte
Der Unicode-Feld in Persisch ist. Die Spur ist wieder für Zeile car = cur.fetchone_asdict()
[Bearbeiten]
Ich habe für Datenbankkollatierung in Datenbankeigenschaften von SQL Server Management Studio überprüft und es ist:
Arabic_CI_AS
Aber wenn ich, dass in charset gibt es:
LookupError: unknown encoding: Arabic_CI_AS
Dieser Fehler zu dieser sehr ähnlich zu sein scheint: http://stackoverflow.com/questions/9090915/how-to-read-large-file-with-unicode-in-python-3 –