[BUGFIX] Respect multi-byte values in search sword 02/56802/2
authorBenni Mack <benni@typo3.org>
Wed, 25 Apr 2018 04:34:30 +0000 (06:34 +0200)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Wed, 25 Apr 2018 10:08:33 +0000 (12:08 +0200)
Resolves: #84857
Releases: master, 8.7
Change-Id: I72563fad6233f0508273f6a75b2f7ab51894e501
Reviewed-on: https://review.typo3.org/56802
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/indexed_search/Classes/Controller/SearchController.php

index 3ba251b..fe838ba 100644 (file)
@@ -868,9 +868,8 @@ class SearchController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControlle
      */
     protected function getSearchWords($defaultOperator)
     {
-        // Shorten search-word string to max 200 bytes (does NOT take multibyte charsets into account - but never mind,
-        // shortening the string here is only a run-away feature!)
-        $searchWords = substr($this->getSword(), 0, 200);
+        // Shorten search-word string to max 200 bytes - shortening the string here is only a run-away feature!
+        $searchWords = mb_substr($this->getSword(), 0, 200);
         // Convert to UTF-8 + conv. entities (was also converted during indexing!)
         if ($GLOBALS['TSFE']->metaCharset && $GLOBALS['TSFE']->metaCharset !== 'utf-8') {
             $searchWords = mb_convert_encoding($searchWords, 'utf-8', $GLOBALS['TSFE']->metaCharset);