Highlighting is broken when content is not just latin-1 as there is no 'u' regexp modifier. Proposed patch provided.

CommentFileSizeAuthor
#2 unicode-regexp.patch1.05 KBsinijkit
unicode-regexp.patch719 bytessinijkit

Comments

awolfey’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Status: Needs review » Needs work

I tried this on the dev version of the module and it didn't work - the words were still not highlighted. Could you re-roll this on the dev version?
Thanks.

sinijkit’s picture

Status: Needs work » Needs review
StatusFileSize
new1.05 KB

I have no chances to test dev version now, but patch is pretty straightforward and should work.
Attaching patch against dev version.

awolfey’s picture

I've tried again to test this and can't get it to work.

I applied your patch. Created a node in Russian. Fuzzysearch finds the node, but can't find the word to highlight.

This line should find the word, but it doesn't:

preg_match('/'. $word .'/iu', $node->body, $matches, PREG_OFFSET_CAPTURE, $location)

I have mbstring enabled.

Can you think of why this might not be working for me?

sinijkit’s picture

Does this dumb test works for you?

<?
$a="Мухаха";
$b="Хаха";
print preg_match('/'.$b.'/iu',$a) ? "matched\n" : "not matched\n";
print preg_match('/'.$b.'/i',$a) ? "matched\n" : "not matched\n";
?>

Expected output (how it looks on my boxes):

whale@satellite:~$ php t.php
matched
not matched

Locale is en_US.UTF-8
mbstring settings (I believe they are usual drupal settings)

whale@satellite:~$ php -i|grep mbstring
mbstring
mbstring extension makes use of "streamable kanji code filter and converter", which is distributed under the GNU Lesser General Public License version 2.1.
mbstring.detect_order => no value => no value
mbstring.encoding_translation => Off => Off
mbstring.func_overload => 0 => 0
mbstring.http_input => pass => pass
mbstring.http_output => pass => pass
mbstring.internal_encoding => no value => no value
mbstring.language => neutral => neutral
mbstring.strict_detection => Off => Off
mbstring.substitute_character => no value => no value

php version is:

whale@satellite:~$ php -v
PHP 5.2.12 (cli) (built: Aug 12 2010 09:22:06) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

I have no idea yet what else could be the reason for this.

awolfey’s picture

Status: Needs review » Fixed

OK, this is in. I'm pretty sure it's just my server config keeping this from working for me. Let me know if this is not working for you now. Thanks, sinijkit.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.