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条)

报告相同问题?

悬赏问题

  • ¥200 如何使用postGis实现最短领规划?
  • ¥15 pyinstaller打包错误
  • ¥20 cesm的气溶胶排放文件
  • ¥15 逐月累计,月份不连续,补齐月份
  • ¥15 应用简单的Python代码完成一个学生成绩管理系统
  • ¥15 用matlab求微分方程初值问题
  • ¥15 vscode下编写第三方库opencv与pcl代码时没有代码提示
  • ¥15 能够跑通不报错,如何解决?(标签-matlab)
  • ¥15 MOS在RDS较大,频率高时开关波形异常
  • ¥15 SCENIC分析报错求解答