Dear Sir,
i am facing a problem with encoding for arabic characters.
here is the code:
1.test.html
[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.XMLHT TP");}
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.onreadystat echange = function(){
if(obj.readySta te == 4){
func(obj.respon seText);
}
}
}
}
function getUpdate(txt){
document.getEle mentById('getRe turn').innerHTM L = txt;
}
</script>
<input type="text" id="test" name="test" value="blah" onkeyup="AJAX.g et('test.php?x= ' + this.value, getUpdate)" />
<div id="getReturn"& gt;</div>
</body>
</html>
[/HTML]
2.test.php
[CODE=php]<?php
header('Content-Type: text/html; charset=utf-8');
echo $_GET['x'];
?>
[/CODE]
...
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: Õ Õ Õ
output:? ? ?
so can anyone tell me how to solve this problem?
Regards,
Faruk Chowdhury
i am facing a problem with encoding for arabic characters.
here is the code:
1.test.html
[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.XMLHT TP");}
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.onreadystat echange = function(){
if(obj.readySta te == 4){
func(obj.respon seText);
}
}
}
}
function getUpdate(txt){
document.getEle mentById('getRe turn').innerHTM L = txt;
}
</script>
<input type="text" id="test" name="test" value="blah" onkeyup="AJAX.g et('test.php?x= ' + this.value, getUpdate)" />
<div id="getReturn"& gt;</div>
</body>
</html>
[/HTML]
2.test.php
[CODE=php]<?php
header('Content-Type: text/html; charset=utf-8');
echo $_GET['x'];
?>
[/CODE]
...
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: Õ Õ Õ
output:? ? ?
so can anyone tell me how to solve this problem?
Regards,
Faruk Chowdhury
Comment