List:MySQL and .NET« Previous MessageNext Message »
From:Reggie Burnett Date:October 27 2004 3:42pm
Subject:Re: Unicode Problem with MySql and C#
View as plain text  
Duncan

This should be corrected in beta 2.  When you say that  you checked the 
server and it shows character_set_connection as utf8, how were you 
checking it?  Remember that each connection can have a different set of 
character sets so just because the command line client shows utf8 
doesn't mean that your connection with Connector/Net is.  In fact, I 
fixed  a bug in C/net where the connector was doing a set 
character_set_client=utf8; set character_set_results=null;

This is a problem because it leaves the character_set_connection as the 
default (possibly latin1) and will convert everything sent over to that 
charset.  The right thing to do is "SET NAMES utf8; set 
character_set_results=null".  This is what beta 2 is doing and we are 
having much better results with languages.

-reggie

Duncan Paul Attard wrote:

> I have a problem regarding unicode characters and MySql.
> I am using MySql 4.1 and MySql Connector/NET together with
> C#.
>  
> My question is whether I' am making a silly mistake (or not),
> by not being able to store unicode characters in a simple table.
>  
> The database I have created is supposed to be in unicode:
> 'CREATE DATABASE test CHARACTER SET utf8'.
>  
> Now, connecting from C#, i am trying to write into a simple
> table, with one column, the value '\u0120\u0121\u0125\u0411'
> but when I am retrieving the value from the table, '????' is
> returned as a result.
>  
> I don't know if its relevant, but i have checked that the
> server and connection are using unicode encoding:
>  
> SHOW VARIABLES LIKE 'character_set_server' which returns
> 'utf8' as a result.
>  
> also:
> SHOW VARIABLES LIKE 'character_set_connection' returns
> 'utf8' as a result.
>  
> I would very much appreciate if someone would answer this
> question.
>  
> Thanks in advance, and looking foward to hearing from someone,
> Duncan.
>
>------------------------------------------------------------------------
>
>Outgoing mail is certified Virus Free.
>Checked by AVG Anti-Virus (http://www.grisoft.com).
>Version: 7.0.269 / Virus Database: 264.12.3 - Release Date: 25/10/2004
>
>  
>

-- 
Reggie Burnett, Software Developer
MySQL Inc, http://www.mysql.com

Thread
Unicode Problem with MySql and C#Duncan Paul Attard26 Oct
  • Re: Unicode Problem with MySql and C#Jorge Bastos26 Oct
  • Re: Unicode Problem with MySql and C#Reggie Burnett27 Oct
  • Re: Unicode Problem with MySql and C#Jorge Bastos27 Oct
    • Re: Unicode Problem with MySql and C#Reggie Burnett27 Oct