Browse Source

Fix encoding issues with accented characters

The 'highlight' method of SearchNoticeListItem (noticesearch.php) messes
up the encoding of results sometimes so override showResults() and use a
regular NoticeList instead of SearchNoticeList.

FIXME: We should fix the underlying issue with the highlight() method.

Ref. #2
Chimo 7 months ago
parent
commit
6c3b940bab
No known key found for this signature in database
1 changed files with 23 additions and 0 deletions
  1. 23
    0
      actions/enoticesearch.php

+ 23
- 0
actions/enoticesearch.php View File

@@ -138,5 +138,28 @@ class EnoticesearchAction extends NoticesearchAction
138 138
     {
139 139
         // pass
140 140
     }
141
+
142
+    // The 'highlight' method of SearchNoticeListItem (noticesearch.php) messes up
143
+    // the encoding of results sometimes (see issue #2) so this is a copy of
144
+    // showResults() that uses a regular NoticeList instead of SearchNoticeList
145
+    // FIXME: We should fix the underlying issue with the highlight() method
146
+    function showResults($q, $page)
147
+    {
148
+        if (Event::handle('StartNoticeSearchShowResults', array($this, $q, $this->notice))) {
149
+            if ($this->notice->N === 0) {
150
+                $this->showEmptyResults($q, $page);
151
+            } else {
152
+                $terms = preg_split('/[\s,]+/', $q);
153
+                $nl = new NoticeList($this->notice, $this, $terms); //
154
+                $cnt = $nl->show();
155
+                $this->pagination($page > 1,
156
+                                  $cnt > NOTICES_PER_PAGE,
157
+                                  $page,
158
+                                  'noticesearch',
159
+                                  array('q' => $q));
160
+            }
161
+            Event::handle('EndNoticeSearchShowResults', array($this, $q, $this->notice));
162
+        }
163
+    }
141 164
 }
142 165
 

Loading…
Cancel
Save