MySQL 5.1 Reference Manual  /  ...  /  Character Set for Error Messages

10.1.6 Character Set for Error Messages

This section describes how the server uses character sets for constructing error messages and returning them to clients. For information about the language of error messages (rather than the character set), see Section 10.2, “Setting the Error Message Language”.

In MySQL, the server constructs error messages and returns them to clients as follows:

  • The message template has the character set associated with the error message language. For example, English, Korean, and Russian messages use latin1, euckr, and koi8r, respectively.

  • Parameters in the message template are replaced with values that apply to a specific error occurrence. These parameters use their own character set. Identifiers such as table or column names use UTF-8. Data values retain their character set. For example, in the following duplicate-key message, 'xxx' has the character set of the table column associated with key 1:

    Duplicate entry 'xxx' for key1

The preceding method of error-message construction can result in messages that contain a mix of character sets unless all items involved contain only ASCII characters. This issue is resolved in MySQL 5.5, in which error messages are constructed internally within the server using UTF-8 and returned to the client in the character set specified by the character_set_results system variable.

Download this Manual
User Comments
Sign Up Login You must be logged in to post a comment.