Problem : When you trying to use localizations in to you web system with MySql, You may face following problem.
"Incorrect string value: '\xE0\xB6\xB8\xE0\xB6\xBD...' for column 'gen_local_value_si' at row 1"
where gen_local_value_si is the column name which occurring the error.
So the issue is the character encoding is not done well for Unicode. We need to specify the charterer encoding to "UTF-8" and Collate to "utf8_general_ci".
Solution :
Simply set the character set and collate by executing of following command
ALTER TABLE my_database.my_table MODIFY COLUMN gen_local_value_si VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
Try on inserting localization values. If it's not work, then do the following configurations
To check the variables, execute following command
This will show the character set which already set.
To set above character sets insert the followings to your /etc/my.cnf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
default-character-set = utf8
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
"Incorrect string value: '\xE0\xB6\xB8\xE0\xB6\xBD...' for column 'gen_local_value_si' at row 1"
where gen_local_value_si is the column name which occurring the error.
So the issue is the character encoding is not done well for Unicode. We need to specify the charterer encoding to "UTF-8" and Collate to "utf8_general_ci".
Solution :
Simply set the character set and collate by executing of following command
ALTER TABLE my_database.my_table MODIFY COLUMN gen_local_value_si VARCHAR(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
Try on inserting localization values. If it's not work, then do the following configurations
To check the variables, execute following command
mysql> show variables like 'char%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
This will show the character set which already set.
To set above character sets insert the followings to your /etc/my.cnf
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
default-character-set = utf8
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8
Comments
Post a Comment