Hello to add to the above points.
As with MySQL 5.5, it does not support utf16 or utf32 character encoding.
There are a few things to look for from
- Client connecting to DB
- DB itself
On the client side, it calls a query to the database with the request encoded in a specific format, and the intact server must understand these requests and respond in a specific format, which the client can understand in turn.
Point 1:. Therefore, we need to set the encoding at the client level, in the connection string, as
Charset=utf8;
And in turn, you need to check with DB and the table (in which you are looking for a query transaction) charset and collation
There are four levels of encoding encoding and matching on the MySQL server for flexibility
- Charset for the whole server server_character_set
- Charset for database
- Codes for the table
- Shell for table columns also
you can check these values ββusing the following query
show variables like 'character%'; show variables like '%collation%';
So, the point is the DB server that reads these queries in the encoding specified on the connection string.
Point 2 Instead of specifying the character set in the connection string, you can also set the encoding for the client (at which the server interrupts) when requested after opening the connection
set names 'charset'; Ex: set names 'utf8';
There are 3 server parameters that are significant in specific problems with the encoding from client to server character_set_client - The server sets the specified encoding for the client - requests sent to character_set_connection - The server sets the specified encoding for the character_set_results connection transaction - The server sets the specified encoding for the returned results, error messages from DB to the client
Point 3 Instead of points 1 and 2, you can set these variables in the database to ensure proper client server transaction
Basically, the encoding and type of client-database matching (server, db table, column) should be similar in order to avoid data loss during database transactions.
Hope this helps .....