diff --git a/code/solr/SolrIndex.php b/code/solr/SolrIndex.php index 14da30d..66479f4 100644 --- a/code/solr/SolrIndex.php +++ b/code/solr/SolrIndex.php @@ -439,10 +439,17 @@ abstract class SolrIndex extends SearchIndex { foreach($res->highlighting->$docId as $field => $highlights) { $combinedHighlights = array_merge($combinedHighlights, $highlights); } - $result->Excerpt = DBField::create_field('HTMLText', implode(' ... ', $combinedHighlights)); - // Remove entity-encoded U+FFFD REPLACEMENT CHARACTER. - // It signifies non-displayable characters, and shows up as such itself in browsers (questionmark icon) - $result->Excerpt = str_replace('�', '', $result->Excerpt); + + // Remove entity-encoded U+FFFD replacement character. It signifies non-displayable characters, + // and shows up as an encoding error in browsers. + $result->Excerpt = DBField::create_field( + 'HTMLText', + str_replace( + '�', + '', + implode(' ... ', $combinedHighlights) + ) + ); } } }