douzhaocheng4533 2011-11-23 03:17
浏览 56
已采纳

urlencode中的符号错误,PHP [关闭]

I am currently writing a parser for html file generated from doc files. The strings contains symbols like alpha beta etc... the problem is when I do a urldecode(urlencode(alpha)); its not giving the symbol.. it returns something else.

To find my problem just check

urldecode("%0A%20%20If%20%3Ci%20style%3D%22mso-bidi-font-style%3Anormal%22%3E%CE%B1%3C%2Fi%3E%2C%20b%2C%20g%0A%20%20be%20the%20zeroes%20of%20the%20polynomial%20%3Ci%20style%3D%22mso-bidi-font-style%3Anormal%22%3Eax%3C%2Fi%3E%3Csup%3E3%3C%2Fsup%3E%0A%20%20%2B%20b%3Ci%20style%3D%22mso-bidi-font-style%3Anormal%22%3Ex%3C%2Fi%3E%3Csup%3E2%3C%2Fsup%3E%20%2B%20c%3Ci%20style%3D%22mso-bidi-font-style%3Anormal%22%3Ex%3C%2Fi%3E%20%2B%20d%2C%20the%20the%20value%20of%20%3Ci%20style%3D%22mso-bidi-font-style%3Anormal%22%3E%26nbsp%3B%CE%B1%3C%2Fi%3Eb%20%2B%20bg%20%2B%20g%3Ci%20style%3D%22mso-bidi-font-style%3Anormal%22%3E%20%CE%B1%3C%2Fi%3E%26nbsp%3B%20is%0A%20%20");

Is there a way to fix this?

  • 写回答

2条回答 默认 最新

  • dot_0620 2011-11-23 04:28
    关注

    You have a character set mismatch. The symbol is likely decoded to UTF-8, but you are interpreting the site as something else, likely Latin-1. To confirm that, choose UTF-8 from your browser's View > Encoding menu. Set an appropriate header so the site is always interpreted using UTF-8:

    header('Content-Type: text/html; charset=utf-8');
    

    This means you also need to make sure the rest of your site is valid UTF-8, or otherwise match the encoding of your text.

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

报告相同问题?

悬赏问题

  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch