encoding problem with arabic character
Dear Sir,
i am facing a problem with encoding for arabic characters.
here is the code:
1.test.html
<html>
<body>
<script type="text/javascript">
var AJAX = {
initialize: function(){
var xmlHTTP;
try{xmlHTTP = new XMLHttpRequest();}
catch(e){
try{xmlHTTP = new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){
try{xmlHTTP = new ActiveXObject("Microsoft.XMLHTTP");}
catch(e){
alert("Your browser does not support AJAX!");
return false;
}
}
}
return xmlHTTP;
},
get: function(url, func){
var obj = this.initialize();
obj.open('GET', url, true);
obj.send(null);
obj.onreadystatechange = function(){
if(obj.readyState == 4){
func(obj.responseText);
}
}
}
}
function getUpdate(txt){
document.getElementById('getReturn').innerHTML = txt;
}
</script>
<input type="text" id="test" name="test" value="blah" onkeyup="AJAX.get('test.php?x=' + this.value, getUpdate)" />
<div id="getReturn"></div>
</body>
</html>
2.test.php
<?php
header('Content-Type: text/html; charset=utf-8');
echo $_GET['x'];
?>
...
if i put english character then there is no problem.
ie. input: f f f output: f f f
but if i put arabic character then i got error.
i.einput: #213; #213; #213;
output:? ? ?
so can anyone tell me how to solve this problem?
Regards,
Faruk Chowdhury
|