Search function and special characters æøå

Permalink 1 user found helpful
Hello everyone,

I have been struggling with the search function. It seems that words containing special characters like æ, ø and å are returning with no results. My site is hosted by concrete5. Im running concrete5 version 5.4.1.1. I have checked the database and Collation is set to utf8_general_ci.

The search controller.php file is containing this line of code:

$regex = '([a-z|A-Z|0-9|\.|_|\s]{0,45})'. $highlight .'([a-z|A-Z|0-9|\.|_|\s]{0,45})';


and this line:

$_q = preg_replace('/[^A-Za-z\']/i', '', $_REQUEST['query']);


Do I need to change the regular expressions and somehow include the special characters before I can make the search function work with special characters. ?

Thank you in advance.

87up
 
Ale replied on at Permalink Reply
Any luck with this one? I'm also struggling with searches containing accented characters like "ä" and "ö"...
msglueck replied on at Permalink Reply
msglueck
I changed the regex to include German Umlaute (that was my problem) with this change:

$_q = preg_replace('/[^A-ZÄÜÖa-zäöüß\']/i', '', $_REQUEST['query']);


Try inserting an echp $p; and echo $_p; to find out what happens there. In my case the added characters just were removed by the regex.

hope this helps.
Ale replied on at Permalink Reply
Thanks a lot! Problem solved.
PatrickHeck replied on at Permalink Reply
PatrickHeck
Try adding the latest version of the controller.php from the repository like suggested here.http://www.concrete5.org/community/forums/customizing_c5/a-weird-se... then everything should work fine.