How to insert Hindi into Mysql

I changed the character set but not working

CREATE TABLE `tbl_hindi` ( `data` varchar(1000) character set utf8 collate utf8_bin default NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; INSERT INTO `tbl_hindi` VALUES ('कंप्यूटर'); 
+7
source share
7 answers

The database shell must be utf8_unicode_ci .

Try creating a new database as well as a new table.

 CREATE DATABASE hindi_test CHARACTER SET utf8 COLLATE utf8_unicode_ci; USE hindi_test; CREATE TABLE `hindi` ( `data` varchar(200) COLLATE utf8_unicode_ci NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; INSERT INTO `hindi` (`data`) VALUES ('कंप्यूटर'); 

This works on my installation. If this does not work for you, there may be something wrong with your server settings.

+14
source

You do not need to change the database, all you need to do is change the column of the table.

 ALTER TABLE `YOUR TABLE` CHANGE `data ` `data ` VARCHAR(1000) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL; 

This change works great and is very possible.

+2
source

Try the following:

 CREATE TABLE tbl_hindi ( data nvarchar(1000), ); INSERT INTO tbl_hindi VALUES (N'कंप्यूटर'); SELECT * FROM tbl_hindi; 
+1
source

If the table has already been created and the problem is to save (your) local language characters, utf8_general_ci or utf16_general_ci will be for you: Request for the next fire:

 ALTER TABLE 'tbl_hindi' CHANGE 'data' 'data' VARCHAR(100) CHARSET utf8 COLLATE utf16_general_ci DEFAULT '' NOT NULL; 

If this also does not solve your problem, try changing the database sorting to utf16_general_ci .

0
source

from your phpmyadmin change, change your table to utf16_general_ci ... Note: this worked for me ..

0
source

You need to modify the table to insert the Hindi value using this code

 `ALTER TABLE 'your table name' MODIFY 'column name' VARCHAR(20) CHARACTER SET UTF8;` 

To display Hindi on your web pages you need to use the code

 `<meta charset="UTF-8">` 

between the <head> .

For a detailed explanation of this, click here to find out more.

Happy coding!

0
source

just use N to a value like this $ sql = "insert into indextbl Values ​​('Null', N '$ abc')";

-1
source

Source: https://habr.com/ru/post/919500/


All Articles