浏览器对URL中的UTF8编码字符的支持 [英] Browser Support for UTF8 Encoded Characters in URL's
问题描述
如果我使用特殊的UTF8编码字符导航到以下URL,则在Web浏览器中会得到不同的结果:
If I navigate to the following URL with a special UTF8 encoded character I get different results in web browsers:
- Firefox 37-显示上述正确的URL.
- Chrome 42-显示如上所述的正确网址.
- 边缘-显示如上的正确URL.
- IE 11-显示百分比编码的URL http://example.com/l %c3%b6rick%c3%a8/
- Firefox 37 - Shows the correct URL as above.
- Chrome 42 - Shows the correct URL as above.
- Edge - Shows the correct URL as above.
- IE 11 - Shows percent encoded URL http://example.com/l%c3%b6rick%c3%a8/
在哪里可以找到支持此功能的浏览器和版本的列表,并且有任何有关新Microsoft Edge浏览器是否支持此功能的公告.
Where can I find a list of browsers and versions that support this feature and are there any announcements of whether the new Microsoft Edge browser supports this.
此 StackOverflow帖子为有兴趣的人强调了以上问题.
This StackOverflow post highlights the above issue for those interested.
推荐答案
浏览器地址栏中显示的内容不一定是内部使用的.
What is shown in browser address bars is not necessarily what is used internally.
如果您在Firefox中输入http://example.com/lörickè
,它会像这样显示,但实际上它会进行百分比编码并变成http://example.com/l%C3%B6rick%C3%A8
.这是出于可用性的原因(或者,如果不支持将IRI转换为URI(例如在HTTP/1.1中使用IRI),则用户不必输入正确的URL(使用百分比编码),而不必看到这些神秘的部分就不会感到困惑.
If you enter http://example.com/lörickè
in Firefox, it gets shown like that, but it actually gets percent-encoded and becomes http://example.com/l%C3%B6rick%C3%A8
. This is for usability reasons (or, if IRIs are not supported, like in HTTP/1.1, for transforming an IRI into a URI), so users don’t necessarily have to enter the correct URL (with percent-encoding), and don’t get confused by seeing these cryptic parts.
您可以轻松地检查将URL从地址栏中粘贴到文本文档中的真正用途.
因此,示例中的三个浏览器可能使用相同的URI(即百分比编码),但是两个浏览器决定改为显示未编码的变体.
So the three browsers from your example probably use the same URI (i.e., percent-encoded), but two browsers decided to display the un-encoded variant instead.
这篇关于浏览器对URL中的UTF8编码字符的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!