Bug #35592 Unable to read multi byte string via myodbc driver
Submitted: 27 Mar 2008 9:07 Modified: 1 Apr 2008 0:40
Reporter: Yogish Baliga Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / ODBC Severity:S1 (Critical)
Version:3.51.x OS:Linux
Assigned to: CPU Architecture:Any

[27 Mar 2008 9:07] Yogish Baliga
Description:
I have  a table with utf8 character set and one column 

create table utf8 ( a char(1) ) charset=utf8 type=InnoDB

I have few rows with a multibyte character in it ( 2 byte as well as 3 byte characters )

When I do select a from utf8 with "set names utf8" as well as "charset=utf8" (part of connection string), I get only one character back.

But If I change the size of column "a" to char(3), I get all bytes.

Via mysql C API, I can get full characters even when the size of the column is char(1) [ with set names utf8 on the client ]

How to repeat:
create table utf8 ( a char(1) ) charset=utf8 type=InnoDB

Insert a row with some multibyte character.

Do select a from utf8 via ODBC driver. I am using isql of unixODBC. 

Result is only character is returned.
[27 Mar 2008 9:15] Tonci Grgin
Hi Yogish and thanks for your report.

MyODBC 3.51 was never designed for use with MB charsets, please use MyODBC 5.1 for this purpose. Be sure to check UnixODBC site too as they have troubles with MB csets of their own.
[27 Mar 2008 19:04] Yogish Baliga
Where can I download myodbc 5.1?
[27 Mar 2008 19:13] Yogish Baliga
Sorry.. I got downloaded it.

3.51.x has re-entrant version of the driver. 5.1 has only one version of the library. Does that mean it is thread safe and do not need re-entrant version?
[1 Apr 2008 0:40] Yogish Baliga
Can anyone please comment here.
[1 Apr 2008 0:45] Jim Winstead
There is only one driver shipped with Connector/ODBC 5.1, and it is thread-safe.