Sunday, 15 September 2013

If I change the character set of a MySQL database, do I need to modify Ruby clients? -


I have a collection of Ruby scripts that use my MySQL database. I need to modify the character set for this database, especially to replace tables from Latin 1 to UTF8. Do I need to modify my scripts? I have seen and I think that I can set the character set for a connection, is it mandatory?

I do not need to make any adjustments to my hesitation in thinking, considering how the character sets have already been set:

mysql> Show characters like "% Char%"; + -------------------------- + ---------------------- --------------------- + | Variable_name | Price | + -------------------------- + ---------------------- --------------------- + | Character_set_quine | UTF8 | | Character_set_connection | UTF8 | | Character_set_database Latin 1 | Character_set_file system | Binary | | Character_sat_resests | UTF8 | | Character_set_services | Latin 1 | Character_set_system | UTF8 | | Character_sets_rate | /rdsdbbin/mysql-5.6.21.R1/share/charsets/ | + -------------------------- + ---------------------- --------------------- +

Will not suggest that the customer is already using a UTF 8 character set Have you set up?

MySQL manages the encoding and per-column per customer. This means that every column in which the text is stored has an encoding setting, and each connected client has an encoding setting differently. Text encoding will be changed necessarily as a flight between the two if a client sends an SGIS column to store UTF-8 data, MySQL will automatically create that conversion automatically ( And the way to retreat).

In this way, it only really counts the client's encoding when it connects to the database. If you are not explicitly specifying this in your Ruby code, you will receive an implicit default setting. Changing the encoding of a MySQL column will not modify this default encoding. Like: Do nothing.


No comments:

Post a Comment