T
twigster
Hi,
I've a pb with utf8 encoding with safari or firefox.
I retrieve the response of a XMLHttpRequest and depending if I use
safari or firefox I can't manage to get characters like "éàç"
to see an illustration you can try the code below :
(with this code I get a "é" with firefox but not with safari. I need to
add a ut8_decode to get the "é"!)
RQ : the files are encoded in utf8
thank you
// index.php :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
</head>
<body>
<script type="text/javascript" charset="utf-8">
function search() {
var xmlHttp;
if (window.ActiveXObject) xmlHttp = new
ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();
else { alert('JavaScript error : problem with
XMLHttpRequest objects ...'); return;}
var url = "action.php";
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
if (xmlHttp.readyState == 4) { print(xmlHttp.responseText) }
}
function print (response) {
alert(response);
}
search();
</script>
</body>
</html>
-----------------------------------------------------
// action.php
<?php
echo "é";
// or
//echo ut8_decode("é");
?>
I've a pb with utf8 encoding with safari or firefox.
I retrieve the response of a XMLHttpRequest and depending if I use
safari or firefox I can't manage to get characters like "éàç"
to see an illustration you can try the code below :
(with this code I get a "é" with firefox but not with safari. I need to
add a ut8_decode to get the "é"!)
RQ : the files are encoded in utf8
thank you
// index.php :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>untitled</title>
</head>
<body>
<script type="text/javascript" charset="utf-8">
function search() {
var xmlHttp;
if (window.ActiveXObject) xmlHttp = new
ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) xmlHttp = new XMLHttpRequest();
else { alert('JavaScript error : problem with
XMLHttpRequest objects ...'); return;}
var url = "action.php";
xmlHttp.open("GET", url, false);
xmlHttp.send(null);
if (xmlHttp.readyState == 4) { print(xmlHttp.responseText) }
}
function print (response) {
alert(response);
}
search();
</script>
</body>
</html>
-----------------------------------------------------
// action.php
<?php
echo "é";
// or
//echo ut8_decode("é");
?>