Page 1 of 1

Umlauts in Ajax dynamic list

PostPosted: Tue Sep 19, 2006 11:55 am
by westor
As I noticed, the script works well in IE, but not in Firefox. I'm from Germany, we are using umlauts and they are not well coded in urls sended by Firefox.
I fixed up the problem, replacing the follwing line in the dynamic list script:
var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&letters=' + inputObj.value.replace(" ","+");
to
var url = ajax_list_externalFile + '?' + paramToExternalFile + '=1&letters=' + encodeURI(inputObj.value);

Because of encoding, the number of letters may be increased. To have the correct number of letters until the lookup starts, I changed
if(inputObj.value.length<minimumLettersBeforeLookup){
to
if(decodeURI(inputObj.value).length<minimumLettersBeforeLookup){

To have correct lookup-string in php script I used this:
if(isset($_GET['getOrtByLetters']) && isset($_GET['letters'])){
// $letters = preg_replace("/[^a-z0-9 ]/si","",$letters);
$letters = urldecode($_GET['letters']);
...
}

This works fine for me.
Torsten Wesolek
http://www.fitnesswelt.com/