Description:
I use qt 4.6.2 under windows. Qt tries to detect if the odbc driver is unicode capable by performing SQLGETINFO requests about supported conversions by the driver. It requsts SQL_CONVERT_LONGVARCHAR, SQL_CONVERT_CHAR or SQL_CONVERT_VARCHAR and expects the driver to return a bit flag where one of SQL_CVT_WLONGVARCHAR, SQL_CVT_WCHAR or SQL_CVT_WVARCHAR is set.
However the odbc drivers' sqlgetinfo function ONLY sets NON unicode flags as in info.c line 152
MYINFO_SET_ULONG(SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL |
SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT |
SQL_CVT_REAL | SQL_CVT_DOUBLE | SQL_CVT_VARCHAR |
SQL_CVT_LONGVARCHAR | SQL_CVT_BIT | SQL_CVT_TINYINT |
SQL_CVT_BIGINT | SQL_CVT_DATE | SQL_CVT_TIME |
SQL_CVT_TIMESTAMP);
as a consequence unicode characters are not processed properly by qt since is assumes all texts are ASCII
How to repeat:
use any qt database program under windows. Also OpenOffice 3.2 has the same problems with detection of unicode support by the driver. However I do not know if openoffice uses the same detection mechanism
Suggested fix:
Modify line 152 to
MYINFO_SET_ULONG(SQL_CVT_CHAR | SQL_CVT_NUMERIC | SQL_CVT_DECIMAL |
SQL_CVT_INTEGER | SQL_CVT_SMALLINT | SQL_CVT_FLOAT |
SQL_CVT_REAL | SQL_CVT_DOUBLE | SQL_CVT_VARCHAR |
SQL_CVT_LONGVARCHAR | SQL_CVT_BIT | SQL_CVT_TINYINT |
SQL_CVT_BIGINT | SQL_CVT_DATE | SQL_CVT_TIME |
SQL_CVT_TIMESTAMP | SQL_CVT_WLONGVARCHAR | SQL_CVT_WCHAR |
SQL_CVT_WVARCHAR )