Click here to Skip to main content
13,046,184 members (86,226 online)
Rate this:
Please Sign up or sign in to vote.
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.

public void InsertMail(string uid, string from, string to, string subject, DateTime datetime, string message)
                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;
            catch (Exception ex)

Thanks & Regards
Posted 10-Apr-13 21:59pm
Updated 11-Apr-13 3:25am

1 solution

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

Solution 1

I have answered this [here].
Neetesh Agarwal 11-Apr-13 8:51am
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.

SRSHINDE 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.
SRSHINDE 11-Apr-13 9:46am
Which font you are using to display subject and message? Please check if that font supports Hindi.
SRSHINDE 11-Apr-13 9:52am
Please check this link ( which might be useful for you.
Sudhakar Shinde 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
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 11 Apr 2013
Copyright © CodeProject, 1999-2017
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