Internet Explorer不会从URL中显示汉字 [英] Internet Explorer does not display Chinese characters from the URL

查看:186
本文介绍了Internet Explorer不会从URL中显示汉字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




  • 当我使用Google Chrome时,我正在努力显示(使可读)的字符。即使将它们编码为UTF-8也可以显示中文参数。


  • 当我使用Mozilla Firefox时,会显示中文的参数 - 甚至虽然它们被编码为UTF-8。


  • 当我使用Internet Explorer时,它显示以UTF-8编码的参数。




NB URL被编码为UTF-8;我知道这是因为当我复制三个URL并将其粘贴到记事本++时,其中三个显示以下内容:


/ %E6%89%93%E5%BC%80%E7%9B%AE%E5%BD%95 /%E7%9B%B8%E6%9C%BA /%E6%95%B0%E7%A0%81 %E7%9B%B8%E6%9C%BA /%E5%B0%8F%E5%9E%8B%E6%95%B0%E7%A0%81%E7%9B%B8%E6%9C%BA / PowerShot-A480 / p / 1934793


难道Mozilla Firefox和Google Chrome都有这样的改进,可以使编码的String可读也许IE家伙不支持?或者,有没有办法用IE激活?



顺便说一下...去查看>>编码>> Unicode(UTF-8)负责页面中的文本,但对URL中的文本没有任何区别。



任何帮助将不胜感激!

解决方案

我写了一篇有关 Internet Explorer不显示解码版本的非ASCII字符并使用IRI 解决问题。



截至今天,我们有以下情况:


  1. HTML5支持 IRI ,即 URIs支持Unicode字符

  2. HTTP不支持 IRIs ,但所有主流浏览器都将 IRIs 转换为有效(编码) URIs 以检索指定的资源(页面)。

  3. IE支持锚标签的 href 属性中的 IRIs ,并将其正确显示在它的地址栏就像手动输入你的URL(键盘; - ))

  4. 如果你选择对 IRI 因此使其成为 URI ,IE不会解码该 URI 回到 IRI

所以你可以尝试以下内容:


  1. 使用UTF-8保存HTML文件。这样就可以在其中插入任何Unicode字符。

  2. 不要在HTML页面的链接中对你的URL进行百分比编码。只需使用这样的链接:< a href =http://zh.wikipedia.org/wiki/亦思巴奚兵>亦思巴奚兵乱< / a>

可以在W3C上找到一篇关于该主题的精彩文章:多语言网址简介


I am working on a requirement to display (make readable) characters from the URL.

  • When I use Google Chrome, it displays the parameters in Chinese - even though they are encoded to UTF-8.

  • When I use Mozilla Firefox, it displays the parameters in Chinese - even though they are encoded to UTF-8.

  • When I use Internet Explorer, it displays the parameters encoded in UTF-8.

N.B. The URL is encoded to UTF-8; I know that because when I copy the URL from the three of them and paste it to Notepad++ the three of them display the following:

/%E6%89%93%E5%BC%80%E7%9B%AE%E5%BD%95/%E7%9B%B8%E6%9C%BA/%E6%95%B0%E7%A0%81%E7%9B%B8%E6%9C%BA/%E5%B0%8F%E5%9E%8B%E6%95%B0%E7%A0%81%E7%9B%B8%E6%9C%BA/PowerShot-A480/p/1934793

Could it be that Mozilla Firefox and Google Chrome guys have this improvement that can make an encoded String readable and perhaps the IE guys do not support that? Or, is there any way to activate that with IE?

By the way... Going to View >> Encoding >> Unicode (UTF-8) takes care of the text inside of the page but does not make any difference for the text in the URL.

Any help will be greatly appreciated!

解决方案

I've written a blog post about Internet Explorer not displaying the decoded version of non-ASCII characters and using IRIs to solve the problem.

As of today, we have the following situation:

  1. HTML5 supports IRIs, i.e. URIs with Unicode character support
  2. HTTP does not support IRIs, but all major browsers take care of converting IRIs to valid (encoded) URIs to retrieve the specified resource (page).
  3. IE supports IRIs in the href attribute of anchor tags and properly displays them in its address bar just like when you enter your URL by hand (keyboard ;-)).
  4. If you choose to percent-encode your IRI thus making it a URI, IE will not decode that URI back into an IRI.

So you could try the following:

  1. Save your HTML files using UTF-8. This allows you to insert any Unicode character into it.
  2. Do not percent-encode your URLs inside your HTML pages' links. Just use links like this: <a href="http://zh.wikipedia.org/wiki/亦思巴奚兵乱">亦思巴奚兵乱</a>

A great article on the topic can also be found at the W3C: An Introduction to Multilingual Web Addresses.

这篇关于Internet Explorer不会从URL中显示汉字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆