Pyodbc Doesn't Correctly Deal With Unicode Data
I did successfully connected MySQL database with pyodbc, and it works well with ascii encoded data, but when I print data encoded with unicode(utf8), it raised error: UnicodeEncode
Solution 1:
I faced the same issue. In addition to using these:
cnxn.setdecoding(pyodbc.SQL_CHAR, encoding='utf-8')
cnxn.setdecoding(pyodbc.SQL_WCHAR, encoding='utf-8')
cnxn.setencoding(encoding='utf-8')
Adding this resolved the issue for me:
cnxn.setdecoding(pyodbc.SQL_WMETADATA, encoding='utf-32le')
Post a Comment for "Pyodbc Doesn't Correctly Deal With Unicode Data"