jarimh1984
07-26-2008, 04:37 PM
Simplified example of my problem code:
function search(){
var search = document.getElementById('searchstring').value;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="search.php"
url=url+"?string="+search
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
search.php
Code:
<?php header('Content-Type: text/html; charset=utf-8');
$searchstring = mysql_escape_string($_GET['string']);
echo $searchstring;
?>
In firefox everything works fine, but in Internet Explorer if I send a searchvalue like öööööö, it echos this �� . If I put $searchstring = utf8_encode($searchstring); in search.php, then it works in Explorer, but of course not in firefox. What would be a good way to fix this.
function search(){
var search = document.getElementById('searchstring').value;
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="search.php"
url=url+"?string="+search
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
search.php
Code:
<?php header('Content-Type: text/html; charset=utf-8');
$searchstring = mysql_escape_string($_GET['string']);
echo $searchstring;
?>
In firefox everything works fine, but in Internet Explorer if I send a searchvalue like öööööö, it echos this �� . If I put $searchstring = utf8_encode($searchstring); in search.php, then it works in Explorer, but of course not in firefox. What would be a good way to fix this.