[Mono-list] MySql.Data and UTF-8?

Reggie Burnett rykr@comcast.net
Wed, 03 Nov 2004 10:33:00 -0600


Keith

I will be adding connection string options to select a character set.  
Currently, however, what happens is that the driver at startup does a 
SET NAMES utf8; SET CHARACTER_SET_RESULS=NULL.  What this means is that 
the server expects all queries to come from the driver as utf8 and, in 
fact, the driver internally sends all queries as utf8.  However, 
resultsets comeback in the character set of the table queried.  So, if 
your server's default character set is latin1, then the textual fields 
from your tables may use latin1 as their character set.  If so, the 
driver will try to create the latin1 encoding to receive those bytes 
from the server.  The problem is that Mono apparently does not currently 
support the GetEncoding("latin1") method.

-reggie

Keith Dreibelbis wrote:

>Hello mono-list,
>
>I am trying out MySql Connector .NET 1.0.1 (beta 2), after using ByteFX
>0.76 for a while.  The mysql database I am trying to talk to runs 4.1.3,
>and uses utf-8 encoding.
>
>I have a unit test which connects, runs some simple queries and closes.
>On Windows, it succeeds fine.  On Mono, it fails in this way:
>
>System.NotSupportedException : Encoding name `latin1' not supported
>in <0x000e4> MySql.Data.MySqlClient.MySqlConnection:Open ()
>in <0x0004a> (wrapper remoting-invoke-with-check)
>MySql.Data.MySqlClient.MySqlConnection:Open ()
>
>That exception seems to be thrown from the end of
>System.Text.Encoding.GetEncoding().  So, I guess the connector Driver is
>asking for "latin1" by default.  I really want to tell it to use "utf8"
>instead; does anyone know how to do this?
>
>I suspected that the connectionstring was the place to do this, but the
>help lists no way to set the encoding.  Please let me know if you have any
>ideas.
>
>
>-kd
>_______________________________________________
>Mono-list maillist  -  Mono-list@lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>  
>