JQuery ajax url call containing accent character send bad Uri from IE to server
I'm having trouble sending a URL containing accent characters using IE. Here's a simple function:
function runjQueryTest(){
var url = "/test/Beyoncé/";
$.get( url, function(){});
}
On the server (PHP) I am writing the value of the request uri ($_SERVER["REQUEST_URI"])
and I can see the difference between what FF / Chrome sends versus what IE sends.
Chrome and FireFox call value ($_SERVER["REQUEST_URI"])
/ test / Beyonc% C3% A9 /
but queries from IE 8 show the value ($_SERVER["REQUEST_URI"])
as
/ test / Beyonc \ xE9
This causes my dispatcher regex engine to not match the server correctly.
Any ideas on what the root problem is and how can I fix it for IE?
Thank!
source to share
I think you need to manually URLEncode the string. Try this short extension: http://plugins.jquery.com/project/URLEncode
Using:
alert( $.URLEncode("This is a \"test\"; or (if you like) an example...");
Output
This%20is%20a%20%22test%22%3B%20or%20%28if%20you%20like%29%20an%20example...
source to share