2013-08-04 37 views
0

首先我的英語不好,所以對此感到抱歉..,
即時通訊嘗試發佈與此功能的希伯來語。
我不知道如何定義編碼(例如Windows-1255)。XMLHttpRequest字符集

function send(){ 
    var sendto = '../includes/chat_post.php?usermsg=' + document.getElementById('usermsg').value + '&fullname=' + document.getElementById('fullname').value + '&submitmsg=' + document.getElementById('submitmsg').value; 
    if(window.XMLHttpRequest){ 
     xmlhttp = new XMLHttpRequest(); 
     xmlhttp.open("POST",sendto,false); 
     xmlhttp.send(null); 
     scroll_downy(); 
    } 
    else{ 
     xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
     xmlhttp.open("POST",sendto,false); 
     xmlhttp.send(); 
     scroll_downy(); 
    } 
    var error = ''; 
    if(error == ''){ 
     document.getElementById('error').innerHTML = ''; 
     showmessages(); 
     scroll_downy(); 
    } 
    else{ 
     document.getElementById('error').innerHTML = error; 
    } 
} 

任何想法來解決它?謝謝大家

回答

0

據我所知,XMLHttpRequest的默認字符集是utf-8,您可以(也應該)使用它來發送希伯來語。但是,您可以設置的字符集與編碼自己:

xmlhttp.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); 
+0

我嘗試過,但在谷歌瀏覽器的工作,並在歌劇中,其給我寫「ש×」,它需要「UI」 –

+0

這就是你」重新登錄服務器,還是回到瀏覽器? – Kraylog