downloadbooks_2014 2011-09-05 22:06
浏览 105
已采纳

特殊字符显示为? 分数

I have some special characters here:
http://209.141.56.244/test/char.php

but when I grab this file via ajax here, they show up as back ? marks:
http://209.141.56.244/test/char.html

These characters should be "ISO-8859-1 Western" but switching my browser encoding to any of the options don't help.

Why is this and how can I fix it?

  • 写回答

2条回答 默认 最新

  • douyinjiao9351 2011-09-05 22:14
    关注

    Your server sends the Ajax response as text/html, this makes the browser assume UTF-8 (which is the default), but your data itself is not UTF-8.

    Send the Ajax response as text/html; Charset=Windows-1252 (you're not really using ISO-8859-1) and it should work.

    header('Content-Type: text/html; Charset=Windows-1252');
    

    PS: Switching the browser to another charset does not help because this affects the page itself only. Subsequent Ajax responses are still decoded according to their respective headers.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥20 java在应用程序里获取不到扬声器设备