Open GoogleCodeExporter opened 8 years ago
The connect method is designed to handle Unicode strings, so the problem is
probably related to the driver's character set settings.
In particular, ODBC is supposed to support ASCII and UCS2, but most drivers do
not do this correctly. (I am going to add a charset option to pyodbc to handle
this...) Try setting your driver's charset to something UCS2LE compatible and
see if that helped.
If not, can you provide the OS version, driver and driver version? Also, an
ODBC trace would really help.
Original comment by mkleehammer
on 28 Mar 2013 at 10:31
solution:
assume you have a connect string 'connect_str' with chinese characters,the
following example should work.
import locale, pyodbc
connection = pyodbc.connect(connect_str.decode(locale.getpreferredencoding()))
Original comment by fatcam...@gmail.com
on 26 Sep 2014 at 7:26
or you can try:
import locale, sys
connection = pyodbc.connect(connect_str.decode(sys.getfilesystemencoding()))
Original comment by fatcam...@gmail.com
on 26 Sep 2014 at 7:28
Original issue reported on code.google.com by
south...@gmail.com
on 24 Dec 2012 at 7:17