Hi I have developed a windows application which allows user to save data and see data in tamil font. I installed 'Bamini' font (Tamil font), and set textboxs and datagridview to Bamini font. I am able to save and retrieve data in tamil.
The problem is the tamil data i enter is encoded and saved in database for example: if i enter 'இந்தியா' in textbox and save, it is saved as ",e;j_ah" in mysql db (i have set the column character set as utf8). Due to this when i get the data and try to print it, it is printing ",e;j_ah" instead of 'இந்தியா'.
Can anyone let me know what i am doing wrong here?!
Code that i am using to insert the string:
textBox1 values is 'இந்தியா' (since textbox font is set to 'Bamini' tamil font)
string insertdata = "INSERT INTO tamil (country) VALUES (@cnt)";
MySqlCommand cmd = new MySqlCommand(insertdata,connection);
connection.Open();
cmd.Parameters.AddWithValue("@cnt",textBox1.Text);
cmd.ExecuteNonQuery();
connection.Close();
Database affected as follows:
tablename: Tamil
Sno Country
1 ,e;j_ah
Table Structure:
CREATE TABLE `tamil` (
`sno` int(11) auto_increment NOT NULL,
`Description` varchar(50) NOT NULL,
`Country` varchar(50) character set utf8 NOT NULL,
KEY `id_sno` (`sno)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ;
After a long list of trials, i finally found an alternative solution to print tamil characters in my printer. Note: Hardware Tech support informed me that many thermal printers wont accept tamil characters that are sent through raw printer helper class.
So i designed a crsytal report and tried printing, which was immediate success. (My printer is 3inch thermal printer)