Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Site Search - German Site - Problem with Umlaut

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1 2
Go to End
Author Topic: 4338 Views
  • JimAasheim
    Avatar
    Community Member
    12 Posts

    Re: Site Search - German Site - Problem with Umlaut Link to this post

    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>&ouml;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 from

    75   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>

  • Ingo
    Avatar
    Forum Moderator
    801 Posts

    Re: Site Search - German Site - Problem with Umlaut Link to this post

    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

    4338 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.