Bug #5584 Setup of default encoding in InternalConnection.Configure()
Submitted: 15 Sep 2004 1:28 Modified: 16 Sep 2004 13:59
Reporter: Svetoslav Milenov Email Updates:
Status: Won't fix Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:beta 1.0.0 OS:
Assigned to: Reggie Burnett CPU Architecture:Any

[15 Sep 2004 1:28] Svetoslav Milenov
Description:
Setting the default encoding for the connection when used against server v. 3.22.32 fails, when server is started without --default-character-set. Then the server does not contain "character_set" variable, and the method throws "Unknown text encoding.  Aborting!" exception.

How to repeat:
Open a connection to 3.22.32 server, which is started without specifying a default encoding.

Suggested fix:
As by docs:

http://dev.mysql.com/doc/mysql/en/Charset-server.html

Assuming that the absence of the character_set variable is specific for 3.x version, the last if statement in InternalConnection.Configure() should look like:

if (charSet != null)
	driver.Encoding = CharSetMap.GetEncoding( charSet );
else if (! driver.Version.isAtLeast(4, 0, 0))
	//Version 3.x.x ???
	driver.Encoding = CharSetMap.GetEncoding( "latin1" ); //use the defaults
else
	throw new MySqlException("Unknown text encoding.  Aborting!");
[16 Sep 2004 13:59] Reggie Burnett
Connector/Net currently does not support servers prior to 3.23