## com.mysql.jdbc
Class CharsetMapping

    java.lang.Object
      com.mysql.jdbc.CharsetMapping

    public class CharsetMapping

extends java.lang.Object

Mapping between MySQL charset names and Java charset names. I've investigated placing these in a .properties file, but unfortunately under most appservers this complicates configuration because the security policy needs to be changed by the user to allow the driver to read them :(

Field Summary
`static java.lang.String[]` `INDEX_TO_CHARSET` Map of MySQL-4.1 charset indexes to Java encoding names
`static java.lang.String[]` `INDEX_TO_COLLATION` Map of MySQL-4.1 collation index to collation names
`static java.util.Map` `STATIC_CHARSET_TO_NUM_BYTES_MAP`

Constructor Summary
`CharsetMapping()`

Method Summary
`(package private) static java.lang.String` `getCharacterEncodingForErrorMessages(ConnectionImpl conn)` Returns the character encoding for error messages returned from the server.
`static int` `getCharsetIndexForMysqlEncodingName(java.lang.String name)`
`static java.lang.String` `getJavaEncodingForMysqlEncoding(java.lang.String mysqlEncoding, Connection conn)`
`static java.lang.String` `getMysqlEncodingForJavaEncoding(java.lang.String javaEncodingUC, Connection conn)`
`(package private) static int` `getNumberOfCharsetsConfigured()`
`(package private) static boolean` `isAliasForSjis(java.lang.String encoding)`
`(package private) static boolean` `isMultibyteCharset(java.lang.String javaEncodingName)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INDEX_TO_CHARSET

    public static final java.lang.String[] INDEX_TO_CHARSET

  Map of MySQL-4.1 charset indexes to Java encoding names

### INDEX_TO_COLLATION

    public static final java.lang.String[] INDEX_TO_COLLATION

  Map of MySQL-4.1 collation index to collation names

### STATIC_CHARSET_TO_NUM_BYTES_MAP

    public static final java.util.Map STATIC_CHARSET_TO_NUM_BYTES_MAP

Constructor Detail

### CharsetMapping

    public CharsetMapping()

Method Detail

### getJavaEncodingForMysqlEncoding

    public static final java.lang.String getJavaEncodingForMysqlEncoding(java.lang.String mysqlEncoding,
                                                                         Connection conn)
                                                                  throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getMysqlEncodingForJavaEncoding

    public static final java.lang.String getMysqlEncodingForJavaEncoding(java.lang.String javaEncodingUC,
                                                                         Connection conn)
                                                                  throws java.sql.SQLException

  Throws:
    `java.sql.SQLException`

### getNumberOfCharsetsConfigured

    static final int getNumberOfCharsetsConfigured()

### getCharacterEncodingForErrorMessages

    static final java.lang.String getCharacterEncodingForErrorMessages(ConnectionImpl conn)
                                                                throws java.sql.SQLException

  Returns the character encoding for error messages returned from the server. Doesn't return useful values other than Cp1252 until the driver has gone through initialization phase and determined server configuration, as not enough information is available to make an intelligent decision until then.

  Parameters:
    `conn` - the connection to the MySQL server
  Returns:
    the Java encoding name that error messages use
  Throws:
    `java.sql.SQLException` - if determination of the character encoding fails

### isAliasForSjis

    static final boolean isAliasForSjis(java.lang.String encoding)

### isMultibyteCharset

    static final boolean isMultibyteCharset(java.lang.String javaEncodingName)

### getCharsetIndexForMysqlEncodingName

    public static int getCharsetIndexForMysqlEncodingName(java.lang.String name)