0

I am trying to save Hindi content in db so for that i made changes in table as well with this query

ALTER TABLE group_distribution CHARACTER SET UTF8;

and when i run this query

SHOW VARIABLES LIKE 'character_set%';

I got below result

character_set_client    utf8
character_set_connection    utf8
character_set_database  latin1
character_set_filesystem    binary
character_set_results   utf8
character_set_server    latin1
character_set_system    utf8
character_sets_dir  /usr/share/mysql/charsets/

What changes i have to made so my DB support other languages too ?

user3696143
  • 301
  • 2
  • 6
  • 23

2 Answers2

0

I got the issue ..Issue is related to table definition see below

CREATE TABLE `group_distribution` (
  `gd_id` int(11) NOT NULL,
  `gd_tweet` varchar(500) CHARACTER SET latin1 NOT NULL,
  `gd_ht` varchar(45) CHARACTER SET latin1 DEFAULT NULL,
  `gt_created_by` int(11) DEFAULT NULL,
  `gt_team_lead` int(11) DEFAULT NULL,
  `gt_send_to` int(11) DEFAULT NULL,
  `gt_added_dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `gt_update_dt` timestamp NULL DEFAULT NULL,
  `gt_active_flag` tinyint(1) NOT NULL,
  PRIMARY KEY (`gd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Here you can check it clearly show gd_tweet` varchar(500) CHARACTER SET latin1 NOT NULL, have diffrent characterset thats why created issue now i changed it to

CREATE TABLE `group_distribution` (
  `gd_id` int(11) NOT NULL,
  `gd_tweet` varchar(500) CHARACTER SET utf8 NOT NULL,
  `gd_ht` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
  `gt_created_by` int(11) DEFAULT NULL,
  `gt_team_lead` int(11) DEFAULT NULL,
  `gt_send_to` int(11) DEFAULT NULL,
  `gt_added_dt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `gt_update_dt` timestamp NULL DEFAULT NULL,
  `gt_active_flag` tinyint(1) NOT NULL,
  PRIMARY KEY (`gd_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
user3696143
  • 301
  • 2
  • 6
  • 23
0
ALTER TABLE tbl_name CONVERT TO CHARACTER SET utf8;
Shadow
  • 33,525
  • 10
  • 51
  • 64
yush
  • 1