Bug #32161 SQLDescribeColW returns UTF-8 column as SQL_VARCHAR instead of SQL_WVARCHAR
Submitted: 7 Nov 2007 15:39 Modified: 14 Dec 2007 15:59
Reporter: Bogdan Degtyariov Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S2 (Serious)
Version:5.1 OS:Any
Assigned to: Bogdan Degtyariov CPU Architecture:Any
Tags: ADO, SQL_VARCHAR, SQLDescribeColW

[7 Nov 2007 15:39] Bogdan Degtyariov
Description:
When retrieve the data from UTF-8 table MyODBC does not report the SQL type correctly and the result is converted to latin1 (or any other encoding set as default for non-unicode applications).
In particular this affects varchar and text columns.

How to repeat:
Try to insert some data from some unicode (say C#) application and retrieve it back. The data is converted due to incorrect SQL type returned by MyODBC before fetching.

Suggested fix:
Check the encoding and set the proper SQL type.
Already fixed. I need to prepare the patch and the test case...
[19 Nov 2007 15:25] Bogdan Degtyariov
patch and test case

Attachment: patch32161.diff (application/octet-stream, text), 5.62 KiB.

[7 Dec 2007 14:57] Bogdan Degtyariov
patch and test case v2

Attachment: patch32161_v2.diff (application/octet-stream, text), 5.52 KiB.

[7 Dec 2007 18:29] Jim Winstead
agreed that a macro would make this a little cleaner.

also, the test case needs a comment before it:
/**
 Bug #32161: SQLDescribeColW returns UTF-8 column as SQL_VARCHAR instead of SQL_WVARCHAR
*/
[11 Dec 2007 19:00] Jim Winstead
The fix for this bug was committed, and will be in 5.1.1.
[14 Dec 2007 15:59] MC Brown
A note has been added to the 5.1.1 changelog: 
SQLDescribeColW returned UTF-8 column as SQL_VARCHAR instead of SQL_WVARCHAR.