views:

177

answers:

1

Hi, I'm trying to use JQuery's autocomplete plug-in but for some reasons Internet Explorer is not compatible with the other browsers: When there is an accent in the "autocompleted" string it passes it with another encoding.

IP - - [20/Apr/2010:15:53:17 +0200] "GET /page.php?var=M\xe9tropole HTTP/1.1" 200 13024 "http://site.com/page.php" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)"

IP - - [20/Apr/2010:15:53:31 +0200] "GET /page.php?var=M%C3%A9tropole HTTP/1.1" 200 - "http://site.com/page.php" "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/533.2 (KHTML, like Gecko) Chrome/5.0.342.9 Safari/533.2" 

I would like to know if there is anyway I can still decode those variables to output the same result.

+1  A: 

The first one (IE) is unicode You can try php's unicode functions to handle that.

http://php.net/manual/en/function.utf8-decode.php

The second one is url encoded. php also has methods for handling url encoding.

http://php.net/manual/en/function.urldecode.php

vfilby
Hi, Thanks for your answer, can I decode both at the same time?
mnml
Can can run the same string through each function. Worse case scenario you may have to detect IE8 clients and do something slightly different.
vfilby