Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

I am fetching mail using Gmail and its working well if Mail content is in English. But My requirement is if mail is in Hindi(Indian Language) or there is some attachment how to save them in Datbase(MY-SQL). Hindi fonts are showing as a "?????????" in the database.


C#
public void InsertMail(string uid, string from, string to, string subject, DateTime datetime, string message)
        {
            try
            {

                MySqlCommand cmd = new MySqlCommand();

                cmd.Parameters.AddWithValue("@unique_id", uid);
                cmd.Parameters.AddWithValue("@sender", from);
                cmd.Parameters.AddWithValue("@reciever", to);
                cmd.Parameters.AddWithValue("@subject", subject);
                cmd.Parameters.AddWithValue("@date", datetime);
                cmd.Parameters.AddWithValue("@message", message);
                cmd.Parameters.AddWithValue("@mail_status", "unread");
                cmd.Connection = con;
                string query = "Insert Ignore into gmail_inbox1(unique_id,sender,reciever,subject,date,message,mail_status) values (@unique_id,@sender,@reciever,@subject,@date,@message,@mail_status) ";
                cmd.CommandText = query;
                cmd.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {

            }

        }



Thanks & Regards
Neetesh
Posted
Updated 11-Apr-13 3:25am
v5

1 solution

I have answered this [here].
 
Share this answer
 
Comments
Neetesh Agarwal 11-Apr-13 8:51am    
Hello SRSHINDE ,
Sorry to disturb u again but When I Insert Value using code in database the Hindi Font are showing as ??????. While I debug the data_field show value in Hindi. Also when I use same query in MY SQl editor Its stores value in Hindi. Thats a very weird Problem.
I search all things but not get right solution. Can you help me on this.

Thanks
Neetesh
Sudhakar Shinde 11-Apr-13 8:58am    
In database if it is showing correctly then you need to chcek display problem. How are you selecting and displaying? Displaying in web browser then have you set the content type using meta tag?
Neetesh Agarwal 11-Apr-13 9:10am    
No in Database its now showing correctly when I am inserting using code. But when I use Insert query in MY SQL Editor Its working well.
Its a Window Application . How to set content type ?
Neetesh Agarwal 11-Apr-13 9:15am    
I add the code above. Please have a look there. There are two fields "subject" and "message"
In which Data should be in Hindi , while debugging these two fields show in correct form. BUt while query executed Its not store in that form.
Sudhakar Shinde 11-Apr-13 9:46am    
Which font you are using to display subject and message? Please check if that font supports Hindi.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900