使用 php 和 mysql 使用 utf-8 编码将希伯来语存储在数据库中

store Hebrew in database with utf- 8 encoding using php and mysql

我正在建立一个带有希伯来语数据库的网站(使用 php 和 mysql)。 一般来说,我使用 chrome 来测试我的工作... 今天我尝试了 explorer :-0(是的......你一定在想“他妈的为什么要这么做......;))。我发现从 explorer 发送的所有数据都存储在? ????并且无法使用。

我在主页上使用<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

header('Content-Type: text/xml charset=utf-8'); 在发送 xml 文件的 php 页面上(在他收到 get 请求后)

在我的 connect.ini.php 上,我包含了以下代码:

mysql_query("SET NAMES 'utf8'",mysql_connect($host, $user, $password));

我的ajaxjavascript是:

if(xmlHttp.readyState==4||xmlHttp.readyState==0){
   gender=document.getElementById("gender").value;                                                                                       
   xmlHttp.open("GET","file.php?gender="+gender , true);                                                                                    
   xmlHttp.send(null);
   }else{
        setTimeout('submit_quick_start_form()',1000);   
   }

正如我之前在 chrome 中所说的,一切都很好...

请大家帮忙...


(点击查看大图)

显示在前3个GET,按顺序,我发现是Chrome, Firefox 和 IE 都产生不同的结果。但我想从理论上讲,Firefox 做对了。在任何情况下,如果我们对 input.value 进行 encodeURIComponent(),它们都会给出相同的结果(按顺序接下来的 3 个 GET)。像这样:

xhr.open('GET', location.href+"?"+encodeURIComponent(test.value), true)
......