Короче, все равно будут кракозябры.
Проблема в функции:
- Код: Выделить всё
public function highlightedMarkup($fulltext, $highlight) {
$this->hText = $fulltext;
$this->hHighlight = str_replace(array('"',"'","""),'',$highlight); // strip the quotes as they mess the regex
if(!empty($this->hHighlight)) $this->hText = @preg_replace( "#$this->hHighlight#i", '<span class="highlight">$0</span>', $this->hText );
return $this->hText;
}
preg_replace возвращает бред, мучался долго, модификатор "u" не помогает.
В итоге единственное, хоть и дурацкое решение, это конвертировать из UTF-8 в cp1251, дать preg_replace на вход и потом конвертировать из cp1251 обратно в UTF-8
- Код: Выделить всё
if(!empty($this->hHighlight)) {
$this->hText = @preg_replace( "#$this->hHighlight#i", '<span class="highlight">$0</span>', iconv('UTF-8', 'cp1251', $this->hText) );
$this->hText = iconv('cp1251','UTF-8', $this->hText);
}
return $this->hText;
Тогда нормальный текст, а не кракозябры, вопросы или точки.