I've been reading through the MySQL docs on character encodings recently but I'm getting hung up on
I understand that
character_set_client tells the server what character set to expect from the client. So, if I set this to utf8, then I need to make sure that the data I'm sending is actually encoded to utf8.
However, I have the following related questions:
The docs indicate that the server will actually convert the incoming data received from the client to this character set.
So, say I send
latin1, and I have
character_set_client set to
latin1 as well. However, the field being inserted is UTF-8. Do I need to set
character_set_connection to UTF-8 to first convert the data to UTF-8? MySQL won't automatically do the conversion when I try and insert latin1 data into a utf8 field?
#2) field encoding settings
Related to above, what does the field encoding setting actually do? Does it actually perform any transformations when the incoming encoding does not match this encoding?
The description is "indicates the character set in which the server returns query results to the client. This includes result data such as column values, and result metadata such as column names." Why is this needed? Why wouldn't the server just look at the character encoding of the field/table/database/server and use that encoding?