I have a simple XMLHttpRequest request
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(divID).innerHTML=xmlhttp.responseText;
}
xmlhttp.open("GET","page.php?q="+str,true);
xmlhttp.send();
When I try to print text in the AJAX page (page.php) like é it returns something weird
echo "éééé";
However, if I use utf8_encode() it's all fine:
$string=utf8_encode("ééé");
echo $string;
Now my question is., how can I make this whole page utf8 ? I want to have my é correct without having to use utf8_encode() on every string I output. It's working on all my pages, except the ones in ajax. They are all like
<?php
session_start();
code
?>
There's no header defined, I tried
header('Content-Type: text/html; charset=utf-8');
but it's not working.