Internet Explorer 6:ajax请求中未显示欧元符号

时间:2010-08-24 14:38:58

标签: ajax utf-8 internet-explorer-6 character-encoding

我正在使用jquery 1.4.2向php页面发送ajax请求,然后显示结果。

这适用于FF3和IE8,但在IE6中,字符€被替换为正方形,我试图使用header()强制php页面的字符编码,但它没有工作...

我正在使用Zend Studio进行eclipse窗口(projet编码为utf-8)

这是ajax调用:

$.ajax({
  url:'index.php?module=ajax&action=getCommande&no-header=1&id='+id ,
  cache:true,
  success:function(html){
    $("#recap_commande").html(html);
  }
});

请求页面:

<?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"])." €) ";
?>

任何帮助都将受到赞赏。

2 个答案:

答案 0 :(得分:1)

我建议你像以前一样避免连接参数。像这样使用data哈希,以便jQuery负责正确编码url值:

$.ajax({
    url: 'index.php',
    cache: true,
    data: { module: 'ajax', action: 'getCommande', no-header: '1', id: id },
    success: function(html) {
        $('#recap_commande').html(html);
    }
});

还要确保您的网页为utf-8 encoded

答案 1 :(得分:0)

抱歉,这是一个特定的计算机问题,欧元符号在具有相同操作系统和IE6的另一台计算机上正确显示....

我不明白问题来自哪里,我试图清空缓存仍然是相同的... 当警告ajax响应时,€正确显示,复制方形字符然后粘贴在记事本中我可以看到€! ??

如果没有这个愚蠢的ie6,我的生活将变得如此简单!