我想将输入到 textarea 中的马拉雅拉姆文文本保存到 mysql。但是,当我尝试接受表单提交时的马拉雅拉姆语内容时,它会像 ാീàµ,ബഗഗജജ 字符一样返回。但是我使用了 utf-8 编码。谁能帮我。我所做的代码如下:
<?php
$dbLink = mysql_connect('localhost', 'root', 'root');
mysql_query("SET character_set_results=utf8", $dbLink);
mysql_query("SET character_set_connection=utf8", $dbLink);
mb_language('uni');
mb_internal_encoding('UTF8');
mysql_select_db('test',$dblink);
mysql_query("set names 'utf8'",$dbLink);
if(isset($_POST['txt1']))
{
$txt= $_POST['txt1']; // get the unicode text from a submit action.
$cQry= "insert into news (news) values ('$txt')" ;
$cresult = mysql_query($cQry,$dbLink);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta charset="utf-8" />
</head>
<body>
<input type="hidden" id="MicrosoftILITWebEmbedInfo" attachMode="optout" value="">
<script type="text/javascript" src="http://ilit.microsoft.com/bookmarklet/script/Malayalam.js" defer="defer"></script>
<form action="" method="post" accept-charset="utf-8">
<textarea rows="10" charset="utf-8" cols="20" name="txt1"></textarea>
<input type="submit" value="Submit">
</form>
</body>
</html>
先感谢您。