jQuery autocomplete special character (Norwegian) problems

seocochali

New Member
I'm using jQuery's autocomplete function on my Norwegian site. When typing in the Norwegian characters ?, ? and ?, the autocomplete function suggests words with the respective character, but not words starting with the respective character. It seems like I've to manage to character encode Norwegian characters in the middle of the words, but not characters starting with it.I'm using a PHP script with my own function for encoding Norwegian characters to UTF-8 and generating the autocomplete list.This is really frustrating!Code:pHP code:\[code\]$q = strtolower($_REQUEST["q"]);if (!$q) return;function rewrite($string){ $to = array('%E6','%F8','%E5','%F6','%EB','%E4','%C6','%D8','%C5','%C4','%D6','%CB', '%FC', '+', ' '); $from = array('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '-', '-'); $string = str_replace($from, $to, $string); return $string;}\[/code\]\[code\]$items\[/code\] is an array containg suggestion-words.\[code\]foreach ($items as $key=>$value) { if (strpos(strtolower(rewrite($key)), $q) !== false) { echo utf8_encode($key)."\n"; }}\[/code\]jQuery code:\[code\]$(document).ready(function(){$("#autocomplete").autocomplete("/search_words.php", { position: 'after', selectFirst: false, minChars: 3, width: 240, cacheLength: 100, delay: 0 } )});\[/code\]
 
Top