Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: MySQL WinForm
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.
 

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 10-Apr-13 22:59pm
Edited 11-Apr-13 4:25am
v5

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

I have answered this [here].
  Permalink  
Comments
Neetesh Agarwal at 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
SRSHINDE at 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 at 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 at 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.
SRSHINDE at 11-Apr-13 9:46am
   
Which font you are using to display subject and message? Please check if that font supports Hindi.
SRSHINDE at 11-Apr-13 9:52am
   
Please check this link (http://msdn.microsoft.com/en-us/library/y99d1cd3(v=vs.80).aspx) which might be useful for you.
Sudhakar Shinde at 12-Apr-13 9:54am
   
Why are you raising same issue again? As per our communication thread you were able to save in hindi successfully but on windows form you could not see it in Hindi. Did you check the link in last thread?

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

  Print Answers RSS
0 OriginalGriff 280
1 Jochen Arndt 150
2 Kornfeld Eliyahu Peter 120
3 PIEBALDconsult 110
4 Richard MacCutchan 105
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web04 | 2.8.141220.1 | Last Updated 11 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100