i'm using jquery 1.4.2 to send an ajax request to a php page then display the result.
This works fine with FF3 and IE8, but in IE6 the character € is replaced by a square, i tried to force the character encoding of the php page using header() but it didn t work...
I'm working on windows with Zend Studio for eclipse (projet encoding is utf-8)
here is the ajax call :
$.ajax({
url:'index.php?module=ajax&开发者_开发百科amp;action=getCommande&no-header=1&id='+id ,
cache:true,
success:function(html){
$("#recap_commande").html(html);
}
});
requested page :
<?php
header('Content-type: text/html; charset=utf-8');
echo "Récapitulatif de la demande " . $_GET ['id'] . " (".$this->getTotal($nb["COD_ART"],$nb["COD_OPTION"])." €) ";
?>
Any help will be appreciate.
I would recommend you to avoid concatenating parameters as you did. Use the data
hash like this so that jQuery take care of properly encoding url values:
$.ajax({
url: 'index.php',
cache: true,
data: { module: 'ajax', action: 'getCommande', no-header: '1', id: id },
success: function(html) {
$('#recap_commande').html(html);
}
});
Also make sure that your pages are utf-8 encoded.
Sorry, this was a specific computer problem, the euro sign is correctly display on another computer with same OS and IE6 ....
I dont understand where the problem came from , i tried to empty the cache still the same... when alerting ajax response the € is correctly display, when copy the square character then paste it in notepad i can see the € ! ??
my life will be so much simplier without this stupid ie6!
精彩评论