【问题标题】:Internet Explorer 6 : Euro sign not displayed on ajax requestInternet Explorer 6:在 ajax 请求上未显示欧元符号
【发布时间】:2010-08-25 17:21:32
【问题描述】:

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

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

我正在使用 Zend Studio for eclipse 在 windows 上工作(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"])." €) ";
?>

任何帮助将不胜感激。

【问题讨论】:

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


    【解决方案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

    【讨论】:

    • 感谢您的提示!我现在将使用数据。我验证了编码(使用记事本++)它是没有BOM的utf-8。这是响应的萤火虫标头的示例,编码似乎正确。回复 日期 2010 年 8 月 24 日星期二 13:37:34 GMT 服务器 Apache/2.2.15 (Win32) DAV/2 SVN/1.6.6 X-Powered-By PHP/5.3.2 ZendServer Transfer-Encoding chunked Content-Type text/ html; charset=utf-8
    【解决方案2】:

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

    我不明白问题出在哪里,我试图清空缓存还是一样... 当提醒ajax响应时,€正确显示,复制方形字符然后将其粘贴到记事本中我可以看到€! ??

    如果没有这个愚蠢的 ie6,我的生活会简单得多!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-12
      • 2019-08-08
      • 1970-01-01
      • 2017-01-30
      • 2010-10-08
      相关资源
      最近更新 更多