utf8 jquery and ie


utf8 jquery and ie

嗨,我使用此代码将文本保存在数据库中

function commenttext()
{
  var com=document.getElementById("commenttext").value;
  var xmlhttp;
  if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
    xmlhttp=new XMLHttpRequest();
    }
  else
    {// code for IE6, IE5
    xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  xmlhttp.onreadystatechange=function()
  {
    if (xmlhttp.readyState==4 && xmlhttp.status==200)
      {
      document.getElementById("commentpalm").innerHTML=xmlhttp.responseText;
      }
  }
  xmlhttp.open("GET","func/comment.php?comtext="+com,true);
  xmlhttp.send();
  document.getElementById("commenttext").value="";
}

当我在 MySQL 管理员界面中看到 UTF8 字符的数据库字段时????保存.这个兄弟唯一的敌人,即在火狐或铬中很好.我对所有页面使用此代码

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

我的恩可丁是没有 BOM 的 UFT8 .

这个兄弟仅适用于IE

尝试:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

并将此行添加到您的php.ini

  default_charset = "utf-8"

如果您在其中定义的标头已经由 Web 服务器发送,则 <meta> 标记很少真正有帮助。把它放在PHP应用程序的顶部:

header('Content-type: text/html; charset=UTF-8');