Forums » General Discussion

Thread: Client character set 'utf8' is different from server character set 'latin1'

This question is answered. Helpful answers available: 2. Answered answers available: 1.


Permlink Replies: 10 - Pages: 1 - Last Post: Dec 20, 2011 11:52 PM by: marioc Threads: [ Previous | Next ]
peter.maioriello_171

Posts: 4
Registered: 9/27/11
Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 8:59 AM
 
  Click to reply to this thread Reply

I cannot connect to my mySQL server.

Computer:
Windows 7
NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252

I get the following error:

Devart.Data.MySql.InvalidCharsetException
Client character set 'utf8' is different from server character set 'latin1'.
Stack Trace:
at Devart.Data.MySql.MySqlConnection.i()
at Devart.Data.MySql.MySqlConnection.Open()
at Quest.Toad.Db.Connection.OpenConnection(IDbConnection connection)
at Quest.Toad.MySQL.MySQLConnection.OpenConnection(IDbConnection connection)
at Quest.Toad.Db.Connection.AllocConnection()
at Quest.Toad.Db.Connection.Connect(Boolean notify)
at Quest.Toad.Db.Provider.BackgroundConnector.CreateBackgroundConnection()

Why would it think my client is UTF8?


Mauritz

Posts: 313
Registered: 8/23/07
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 12:21 PM   in response to: peter.maioriell...
 
  Click to reply to this thread Reply

Toad for MySQL will unfortunately always try to connect using Unicode because it needs to know the encoding used on the data received and the MySQL server's character sets are not a 1-1 match with what is supported on Windows.



peter.maioriello_171

Posts: 4
Registered: 9/27/11
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 1:47 PM   in response to: Mauritz
 
  Click to reply to this thread Reply

So how can I connect to my database? or can I only connect to UTF8 databases now no matter what?


Mauritz

Posts: 313
Registered: 8/23/07
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 1:57 PM   in response to: peter.maioriell...
 
  Click to reply to this thread Reply

What version of the database are you using?



peter.maioriello_171

Posts: 4
Registered: 9/27/11
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 2:02 PM   in response to: Mauritz
 
  Click to reply to this thread Reply

unfortunately...

version: 4.0.17-log

Before I switched to Windows 7, I had XP and Toad for MySQL (probably an older version) worked fine. Is my mySQL version too old perhaps?


Mauritz

Posts: 313
Registered: 8/23/07
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 2:12 PM   in response to: peter.maioriell...
 
  Click to reply to this thread Reply

A lot of things changed in MySQL in regards to how it handles character sets in both version 4.1 and then even more for version 5.0 and later.

That said I think this might be a bug in our application where we are having issues with version 4.0 of Toad for MySQL. We should still be able to connect to it. Unfortunately I don't think there is any way for you to work around this until we fix the issue (It should start working if you upgrade to something later than 5.0 but I can totally understand how that is a pretty drastic change just to get a tool to work).



peter.maioriello_171

Posts: 4
Registered: 9/27/11
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 2:16 PM   in response to: Mauritz
 
  Click to reply to this thread Reply

Thanks, I appreciate it. We're going to upgrade mySQL soon (I hope).


Mauritz

Posts: 313
Registered: 8/23/07
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 27, 2011 2:18 PM   in response to: peter.maioriell...
 
  Click to reply to this thread Reply

In our defense MySQL 4.0 is pretty ancient. :)

Our test matrix do include testing against MySQL 4.1 but that is as old as we go currently.



TheRealDeal

Posts: 1
Registered: 9/28/11
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 28, 2011 12:17 PM   in response to: peter.maioriell...
 
  Click to reply to this thread Reply

Changing the character set on the server is out of the question, since you need to do it per table, and there are serious ramifications to attempting this with regard to query compatibility. It will break joins and all sorts of stuff.

However you can change your windows character set to latin1 in toad and give that a shot.

Start toad
Tools | Options | Editor | General | File Encoding Type

Change UTF-8 to Western European (aka Latin-1)

Please let me know if that works for you :)


Mauritz

Posts: 313
Registered: 8/23/07
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Sep 28, 2011 12:29 PM   in response to: TheRealDeal
 
  Click to reply to this thread Reply

That setting unfortunately only applies to how the editor opens and saves files, not to the MySQL connection.



marioc

Posts: 1
Registered: 12/20/11
Re: Client character set 'utf8' is different from server character set 'latin1'
Posted: Dec 20, 2011 11:52 PM   in response to: Mauritz
 
  Click to reply to this thread Reply

The same problem happens to me with mysql 6.0.1.1723

Devart.Data.MySql.InvalidCharsetException
Client character set 'utf8' is different from server character set 'latin1'.
Stack Trace:
Devart.Data.MySql.MySqlConnection.i in ()
Devart.Data.MySql.MySqlConnection.Open in ()
in Quest.Toad.Db.Connection.OpenConnection (IDbConnection connection)
in Quest.Toad.MySQL.MySQLConnection.OpenConnection (IDbConnection connection)
Quest.Toad.Db.Connection.AllocConnection in ()
in Quest.Toad.Db.Connection.Connect (Boolean notify)
Quest.Toad.Db.Provider.BackgroundConnector.CreateBackgroundConnection in ()



Toad 5.0.0.345 still works properly.

mysql dbserver version is 5.0.26


Legend
Guru: 2001 + pts
Expert: 751 - 2000 pts
Enthusiast: 31 - 750 pts
Novice: 0 - 30 pts
Moderators
Helpful answer (5 pts)
Answered (10 pts)

Point your RSS reader here for a feed of the latest messages in all forums