Unicode Characters In A Url (all Ok - Except For Ie)
Solution 1:
This is discussed in the following IEBlog article on MSDN:
Non US-ASCII Characters
Characters outside of US-ASCII may appear in Windows file paths and accordingly they’re allowed in file IRIs. (URIs are defined as US-ASCII only and so when including non-US-ASCII characters in a string, what you've actually created is called an IRI: Internationalized Resource Identifier.) Don’t use percent-encoded octets to represent non US-ASCII characters because, in file URIs, percent-encoded octets are interpreted as a byte in the user’s current codepage. The meaning of a URI containing percent-encoded octets for bytes outside of US-ASCII will change depending on the locale in which the document is viewed. Instead, to represent a non-US-ASCII character you should use that character directly in the encoding of the document in which you are writing the IRI. For instance:
Incorrect: file:///C:/example%E3%84%93.txt Correct: file:///C:/exampleㄓ.txt
In other words, since your HTML is using UTF-8, the URL must use non-percent-encoded UTF-8 octets for the é
character, which is why é.html
works and %C3%A9.html
fails - there is no file named é.html
, for example.
This is how Internet Explorer is designed to work. It is not a bug. The other browsers are simply doing something different, that's all. Unless you can configure the webserver to deliver different HTML to IE vs other browsers, you will have to use client-side technology instead, such as conditional comments, eg:
<html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"/><metahttp-equiv="X-UA-Compatible"content="IE=EmulateIE9"><title>website</title></head><body><!--[if IE]>
<a href="é.html">Works on IE</a>
<![endif]--><!--[if !IE]> --><ahref="%C3%A9.html">Works everywhere else</a><!-- <![endif]--></html>
The X-UA-Compatible
meta tag is needed because Microsoft removed support for HTML conditional comments in IE 10 when it implemented support for HTML5.
Post a Comment for "Unicode Characters In A Url (all Ok - Except For Ie)"