Seems like the error appears when getdata.c uses SQL_C_WCHAR in GetDataString
caused by unicode_results=True, python version >= 3, or explicitely patched
ret = SQLGetData(cur->hstmt, (SQLUSMALLINT)(iCol+1), nTargetType, buffer.GetBuffer(), buffer.GetRemaining(), &cbData);
I'm not sure the error appears exaclty when retrieving the unicode field. Still cannot build pyodbc with debug info.
But the only statement executed is: "SELECT TOP 1 LastName FROM Interviewer"
And here is how isql (unixodbc) retrieves unicode field:
SQLCHAR szColumnValue[MAX_DATA_WIDTH+1];
/* include/sqltypes.h: typedef unsigned char SQLCHAR; */
nReturn = SQLGetData( hStmt, nCol, SQL_C_CHAR, (SQLPOINTER)szColumnValue, sizeof(szColumnValue), &nIndicator );
fputs((char*) szColumnValue, stdout );
The latter statement displays string on UTF-8 console.
That does mean that szColumnValue already contains UTF-8 encoded string right after SQLGetData