2008-04-02

This section provides a test on sending non-ASCII character strings to MySQL server in UTF8 encoding.

The next test I did was to re-run the same SQL INSERT statement that included Latin1, UTF-8, GBK and Big5 characters directly. But I changed MySQL session settings with character_set_client=latin1 and character_set_connection=latin1 to see how MySQL applies the conversion when executing the INSERT statement.

Conversion from character_set_connection, utf8, to column String_ASCII's encoding, ascii - Will happen with potential data loss. But the input text for String_ASCII is ASCII characters only and compatible with UTF-8. The output shows no problem.

Conversion from character_set_connection, utf8, to column String_Latin1's encoding, latin1 - Will happen with potential data corruption. MySQL took my Latin1 input string as a UTF-8 string and converted to Latin1. Output of String_Latin1 shows one corrupted character (0xE9 was replaced by 0x3F) in two places.