Bug #8537 Bad support for Cp1250 server charset
Submitted: 16 Feb 2005 10:13 Modified: 18 Feb 2005 20:38
Reporter: Richard Tykwinski Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version: OS:Windows (Windows XP)
Assigned to: Mark Matthews CPU Architecture:Any

[16 Feb 2005 10:13] Richard Tykwinski
Description:
My  mysql server 4.1.1 run with default-charset=cp1250 like
my operating system Windows XP. 

When database url not contain default-charset definition then server charset is not identified properly.

Debugging give me that  MySQLIO.java.serverCharsetIndex is correct and set to value 26, but in Connection.java, is line 
  setEncoding(CharsetMapping.INDEX_TO_CHARSET[this.io.serverCharsetIndex]);
where value 26 get Encoding = null ?

The problem is in CharsetMapping.java which contain line with definition:
   INDEX_TO_CHARSET[26] = (String) MYSQL_TO_JAVA_CHARSET_MAP.get("win1250");
and this points to null !

How to repeat:
Run mysql server with default-charset=cp1250 

Creat XML definition with database url that not contain default-charset definition. 

Suggested fix:
CharsetMapping.java

at line 93 is :
   tempMap.put("Cp1250", "Cp1250");

correct and restore value win1250 like:
   tempMap.put("win1250", "Cp1250");

of course another solution is to change line:
   INDEX_TO_CHARSET[26] = (String) MYSQL_TO_JAVA_CHARSET_MAP.get("win1250");

to
   INDEX_TO_CHARSET[26] = (String) MYSQL_TO_JAVA_CHARSET_MAP.get("Cp1250");
[18 Feb 2005 20:38] Mark Matthews
Fixed for 3.0.17/3.1.8.