MySQL 如何在Mysql中插入印地语

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/11292898/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 14:01:55  来源:igfitidea点击:

How to insert Hindi language in Mysql

mysqlhindi

提问by Sanjay Dutt

I changed the charset set but does not work

我更改了字符集但不起作用

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 ('????????');

回答by J?rgen R

The charset of the database needs to be utf8_unicode_ci.

数据库的字符集需要是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 install. If it doesn't work for you, something might be wrong with your server settings.

这适用于我的安装。如果它对您不起作用,则您的服务器设置可能有问题。

回答by anwerj

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

您不需要更改数据库,您只需要更改表列。

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

This change works fine and very feasible.

这种变化效果很好,非常可行。

回答by sifr_dot_in

If the table has already been created and the problem is about storing (your) local language characters, utf8_general_cior utf16_general_ciwould be for you: Fire following query:

如果表已经创建并且问题是关于存储(您的)本地语言字符,utf8_general_ci或者utf16_general_ci对您来说:触发以下查询:

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

If this too doesn't solve your problem, try altering the database collation to utf16_general_ci.

如果这也不能解决您的问题,请尝试将数据库排序规则更改为utf16_general_ci.

回答by Abhishek Jaiswal

You have to modify your table to insert the Hindi value using this code

您必须使用此代码修改表以插入印地语值

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

For displaying Hindi on your webpages you need to use code

要在您的网页上显示印地语,您需要使用代码

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

in between the <head>tag.

<head>标签之间。

For detail explanation about this, You can click hereto know more.

有关这方面的详细说明,您可以单击此处了解更多信息。

Happy Coding!

快乐编码!

回答by bilal chaudhari

Try this:

尝试这个:

CREATE TABLE tbl_hindi (
    data nvarchar(1000),
);
INSERT INTO tbl_hindi VALUES (N'????????');
SELECT * FROM tbl_hindi;

回答by danish-khan-I

from your phpmyadmin change collation of your table to utf16_general_ci... Note: it worked for me..

从您的 phpmyadmin 将表的排序规则更改为 utf16_general_ci ... 注意:它对我有用..

回答by rakesh goswami

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

只需在这样的值之前使用 N $sql="insert into indextbl Values('Null',N'$abc')";