Bug #36675 VB.NET, ODBC 3.51 DRIVER, UTF-8 DOESN'T WORK
Submitted: 12 May 2008 20:47 Modified: 13 May 2008 12:16
Reporter: m m Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / ODBC Severity:S3 (Non-critical)
Version: OS:Windows (2003)
Assigned to: CPU Architecture:Any
Tags: ODBC, UTF-8

[12 May 2008 20:47] m m
Description:
Hi all,

I'm using VB.net and MySql (MySQL ODBC 3.51 Driver).
In the code I have a Odbc.OdbcDataReader.
I read from the database a varchar or a text.
In the database it looks like:
"foştii săi uriaşi jucători, Hagi şi Lăcătuş".

What the OdbcDataReader returns is this:
"fo?tii s?i uria?i juc?tori, Hagi ?i L?c?tu?".

I've searched all the other bugs and articles but I couldn't find the solution.

Please help me with this.

How to repeat:
The problem seems to be from the reader, not from my code.
[13 May 2008 6:35] Tonci Grgin
Hi and thanks for your report. MyODBC 3.51 wasn't designed to provide this functionality! If you want you can try with MyODBC 5.1

Now, if you insist on 3.51 branch, you may try either setting "Character set" to UTF8 or "Initial statement" to "SET NAMES utf8" but these are just workarounds ("Connect Options" tab).
[13 May 2008 9:55] Susanne Ebrecht
The problem here isn't MyODBC. The problem is that Windows won't support UTF8.

You have to be very careful here with your charset settings.

When you just use MySQL CLI you have to figure out your codepage first.

Usually, open CMD and type CHCP.

Lets say its 850.

Then before you type something at CLI, please do a SET NAMES CP850;

To figure out, if you data are stored correct at the database use the comment: SELECT LENGTH(column_name);

For non English letters length it should count > 1 (i.e. 2 or 3) by storing in an UTF8 table.

To get the right output, you have to set CHARACTER_SET_RESULT to the encoding of your environment, too.

When you codepage is CP850 and this is the value of your CHARACTER_SET_RESULT then you can see all values at CLI in the right way.

MyODBC 3.51 don't support UTF8 so you have to take care that you data will go in with the right encoding.
[13 May 2008 11:23] m m
Hello,

Ok, thank you for helping me.:)
I'm using now the 5.1 driver and it works.
in the database i have :"foştii săi uriaşi jucători, Hagi şi Lăcătuş"
and in my vb.net code i have :"foştii săi uriaşi jucători, Hagi şi Lăcătuş"
so, the same thing, as I wanted.:)

But when i try to insert it(the string "foştii săi uriaşi jucători, Hagi şi Lăcătuş") back to the database, in the database apears like this: fostii sai uriasi jucatori, Hagi si Lacatus", although I have set the fields  ( charset utf-8 and collation utf8_general_ci)

If you can help me with this then it solves everything ( case closed :)) )

Once again, thank you for your help,
Mihai
[13 May 2008 12:16] m m
I've sort it out :) Yey!

All the best,
Mihai
[30 Jan 2012 23:46] Andrew Kelly
How did you fix the issue?