Click here to Skip to main content
15,889,732 members
Please Sign up or sign in to vote.
3.86/5 (3 votes)
See more:
how to store hindi text in mysql
Posted

1 solution

Please find below steps to store and retrieve hindi text.
1) Choose utf8 character set and utf8_general_ci collation.
2) Whenever you want to save and retrieve the data you need to set the characterset as follows.

SQL
//To set the char set
mysql_set_charset('utf8');

//To select hindi data
mysql_query("SELECT * FROM ....");

// To insert hindi data
mysql_query("INSERT INTO ....");



Before you display hindi content in your browser set content type of that page using meta tag.

PHP
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
Share this answer
 
v3
Comments
ujali 11-Apr-13 4:04am    
i tried this ..but while i am editing something in that coloumn in mysql in hindi language ,it is taking ??? this value or storing this value.
Sudhakar Shinde 11-Apr-13 4:11am    
How are you editing the data? Does your editor supports UTF-8 character set?
ujali 11-Apr-13 4:28am    
simply by typing text in colounm in hindi,not typing,i just copy hindi text in colounm and run the table,how to check that my editor supports UTF-8 character set
Neetesh Agarwal 11-Apr-13 4:06am    
Hello SRSHINDE, I am fetchimg Gmail Inbox and need to store data in my-Sql but soe times mail is hindi , some times in English then how to manage this. Please Reply

Thanks
Sudhakar Shinde 11-Apr-13 4:15am    
What is character set and collation of your database? You need to follow above steps to store hindi messages in the database.

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