Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I am working in a Window Application(C#) and database is MY SQL. In Application I am fetching gmail Inbox and save it in to Database. But My problem is that When I am using Insert Query in code "Subject" or "message" column showing message in Hindi but When Its save in Database Its showing character ???????? like this. I already change all things in utf8 in my sql.

And when I Insert same using My sql editor Its saves in Hindi Font. That's a weird situation for me as I am new to MY SQL.
Can It be problem of Window Application but also there is Utf8 set in app.config file.
Posted
Updated 12-Apr-13 4:32am
v3
Comments
Sergey Alexandrovich Kryukov 12-Apr-13 12:11pm    
There is no such thing as "Hindi character". Modern Hindi uses Devanāgarī.
—SA
Sergey Alexandrovich Kryukov 12-Apr-13 12:11pm    
What exactly do you mean by "I already change all things in utf8". What things, exactly?
—SA

 
Share this answer
 
v2
Comments
Neetesh Agarwal 12-Apr-13 10:16am    
Even its not work.
Tel me should I need to install Hindi fonts on my system.
Sergey Alexandrovich Kryukov 12-Apr-13 12:21pm    
It won't help, isn't it obvious?! If you have "???", you don't get a Unicode character already; with a different font, it will remain "???"!

And there is no "Hindi fonts", even if you have some font named like this. All fonts are international. The character repertoire of Devanāgarī is already supported by default by many fonts. You just need to use Unicode and understand what how it works.

Please see my answer and comment to your question.

—SA
Sergey Alexandrovich Kryukov 12-Apr-13 12:17pm    
5d. I added my answer, please see.
—SA
First of all, you need to use Unicode SQL data type, such as nchar, nvarchar, ntext:
http://msdn.microsoft.com/en-us/library/ms191200%28v=sql.100%29.aspx[^].

Please see my comments to the question.

—SA
 
Share this answer
 
v2
Comments
Neetesh Agarwal 13-Apr-13 4:03am    
I solved this by using
message = Convert.ToBase64String(Encoding.UTF8.GetBytes(message));
string Normal_message = Encoding.UTF8.GetString(Convert.FromBase64String(message));
Sergey Alexandrovich Kryukov 13-Apr-13 19:20pm    
Wrong solution! You need to use Unicode, without transcoding to base64, which is utterly inefficient. By the way, isn't it obvious?
Anyway, you can do whatever you want, but until you learn (among many other things) how Unicode work, don't think you are doing any programming.
—SA
Neetesh Agarwal 15-Apr-13 3:26am    
I already did that before this.
Neetesh Agarwal 15-Apr-13 3:30am    
I am just started programming one year ago so I am not good programmer yet.
Sergey Alexandrovich Kryukov 15-Apr-13 3:34am    
Did you check up that the font shows Devanāgarī? You can use "Charmap.exe".
—SA

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