Open GoogleCodeExporter opened 8 years ago
This problem does not exists using Python 2.7.6 and the same other components:
stmt='select cdno from contacts'
cur.execute(stmt)
<pyodbc.Cursor object at 0x06688DE8>
stmt='select cdno as "é" from contacts'
cur.execute(stmt)
<pyodbc.Cursor object at 0x06688DE8>
Original comment by marc.van...@gmail.com
on 20 Jan 2014 at 4:48
Original comment by mich...@kleehammer.com
on 3 Feb 2014 at 1:07
[deleted comment]
I have the same problem:
conexionDSNnavision = pyodbc.connect(DSN=config.DSNnavision, autocommit=True,
ansi=True, readonly=True, unicode_results=True)
cursorDSNnavision = conexionDSNnavision.cursor()
query = "SELECT Nº,Nombre FROM Cliente
cursorDSNnavision.execute(query)
Error:
cursorDSNnavision.execute(query)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xba in position 1: invalid
start byte
but I do this:
conexionDSNnavision = pyodbc.connect(DSN=config.DSNnavision, autocommit=True,
ansi=True, readonly=True, unicode_results=True)
cursorDSNnavision = conexionDSNnavision.cursor()
query = "SELECT Nº FROM Cliente
cursorDSNnavision.execute(query)
works perfectly, what's happening?
Original comment by agar...@empretal.com
on 28 Feb 2014 at 1:26
Workaround:
Executoing the following instruction:
db.execute("SET @@character_set_results = 'latin1'")
before issuing the SELECT statement,
everything works well.
Question now is why is it necessary to do that and how can I know which
character set to use?
Original comment by marc.van...@gmail.com
on 3 Mar 2014 at 10:34
Original issue reported on code.google.com by
marc.van...@gmail.com
on 20 Jan 2014 at 3:34