17488 Posts in 4473 Topics by 1978 members
| Go to End | ||
| Author | Topic: | 3981 Views |
-
Re: Site Search - German Site - Problem with Umlaut

10 November 2008 at 1:02am Last edited: 10 November 2008 1:58am
Any solution by now?
Generally the search works fine.
With umlaute the previously described "no results" occurs.
However, when you search for the word "möchten" but type "möchten" the search does get the results that contain the word.I wonder how the data is stored in the database and if the query parameters need to convert characters to html entities before executing the query and also to convert back to correct HTML to get the umlaute issue solved?
Hint: I'm running SS 2.2.3
Executing the sql query "select id, content from SiteTree limit 10;" from shell (not phpMyAdmin) I get confirmed what was written before: the database contains plain HTML code:
<h4>Pflege ist Dienstleistung, </h4> <p>öde ist langweilig</p>So I would need to convert the search term using htmlentities() before passing it to the query.
Here is what I did (and it's working):
changed line 76 in sapphire/search/SearchForm.php from75 public function getResults($numPerPage = 10){
76 $keywords = $_REQUEST['Search'];into
75 public function getResults($numPerPage = 10){
76 $keywords = htmlentities($_REQUEST['Search'], ENT_QUOTES, 'UTF-8');For the results I used the following in Page_Results.ss template:
<!-- do some decoding here to display results with umlaute etc. correctly -->
<p>$Content.LimitWordCount</p> -
Re: Site Search - German Site - Problem with Umlaut

10 November 2008 at 4:43am
Thanks for your patch and ideas, Jim! The problem is that we'd break special character searches in all other (unescaped) fields like "Title". There's two existing tickets with partial patches for the problem, we need somebody to write unit tests for the existing functionality before we can proceed with making the searchform i18n-compatible. Shouldn't be too hard, the groundwork is done in the patch. Anyone keen?
http://open.silverstripe.com/ticket/2267
http://open.silverstripe.com/ticket/2363
| 3981 Views | ||
| Go to Top |


