doujing6053 2014-01-23 15:22
浏览 62
已采纳

如何在Safari中处理带有“é”字符的URL?

I have files that I need to open/download from my webpage using links in a menu. My problem is when I try to open a file that has an 'É' in it with Safari (7.0.1). It's working with Firefox 26.0, Chrome 32.0.17 and IE.

The name in the URL is correct but the Not Found error shows a complete different name.

In the URL: FORMULAIRE%20-%20ENVOI%20DE%20MESSAGE%20PAR%20TÉLÉCOPIEUR.doc

The page error:

FORMULAIRE - ENVOI DE MESSAGE PAR TÉLÉCOPIEUR.doc was not found on this server.

I tried urlencode(), rawurlencode(), htmlspecialchar() and my page's charset is set to UTF-8.

I absolutely need to keep the accents in the file's name. Someone have an idea?

  • 写回答

4条回答 默认 最新

  • duanben4771 2014-01-23 15:27
    关注

    A handy workaround for dealing with tricky characters in URLs is to use their percent-encoded values. In this case I believe you'd need to pass %C3%89 in place of the É, just like passing a %20 in place of a space.

    So try this:

    FORMULAIRE%20-%20ENVOI%20DE%20MESSAGE%20PAR%20T%C3%89L%C3%89COPIEUR.doc

    It sounds like you're on a Mac, but if you have access to a Windows machine (vm or otherwise) Fiddler is a great swiss-army knife for all things HTTP, and it's tool menu includes a "Text Wizard" which can help with lots of text encoding/decoding.

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

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)