Bug #27182 Connection.getServerCharacterEncoding() method is not working.
Submitted: 15 Mar 2007 17:22 Modified: 11 Sep 2007 18:38
Reporter: Sung-ho Oh
Status: Closed
Category:Connector/J Severity:S3 (Non-critical)
Version:5.0.5 OS:Any (All)
Assigned to: Target Version:
Tags: getServerCharacterEncoding(), character_set

[15 Mar 2007 17:22] Sung-ho Oh
Description:
Connection.getServerCharacterEncoding() method is not working.

current source : 
	protected String getServerCharacterEncoding() {
		return (String) this.serverVariables.get("character_set");
	}

'character_set' is not found in server_variables(MySql 5.0.X)

Maybe...the variable name is 'character_set_server'.

How to repeat:
	protected String getServerCharacterEncoding() {
		return (String) this.serverVariables.get("character_set_server");
	}

Suggested fix:
	protected String getServerCharacterEncoding() {
		return (String) this.serverVariables.get("character_set_server");
	}
[29 Mar 2007 9:31] Tonci Grgin
Verified as described by looking into code.

Connection.java, 3738
	protected String getServerCharacterEncoding() {
		return (String) this.serverVariables.get("character_set");

The character encoding between client and server is automatically detected upon
connection. The encoding used by the driver is specified on the server via the
configuration variable ' character_set ' for server versions older than 4.1.0 and '
character_set_server ' for server versions 4.1.0 and newer.
[4 Sep 2007 19:48] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33656
[4 Sep 2007 20:36] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33662
[4 Sep 2007 20:40] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33663
[4 Sep 2007 20:45] Mark Matthews
Will be in 5.0.8/5.1.3.
[6 Sep 2007 17:14] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33832
[7 Sep 2007 16:04] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/33909
[11 Sep 2007 18:38] MC Brown
A note has been added to the 5.0.8 and 5.1.3 changelogs: 

Connection.getServerCharacterEncoding() doesn't work for servers with version >= 4.1.
[3 Oct 2007 18:42] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34839
[3 Oct 2007 18:46] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34840
[3 Oct 2007 20:59] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/34855
[5 Oct 2007 20:53] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35011
[11 Oct 2007 22:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35407
[11 Oct 2007 22:24] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35410
[11 Oct 2007 22:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/35414
[19 Nov 2007 1:57] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38019
[19 Nov 2007 3:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/38024