diff --git a/core/modules/search/search.module b/core/modules/search/search.module
index e731e4f..4d6f1be
--- a/core/modules/search/search.module
+++ b/core/modules/search/search.module
@@ -1165,7 +1165,7 @@ function search_excerpt($keys, $text) {
           if (($s = strrpos($end, ' ')) !== FALSE) {
             // Account for the added spaces.
             $q = max($q - 1, 0);
-            $s = min($s, drupal_strlen($end) - 1);
+            $s = min($s, strlen($end) - 1);
             $ranges[$q] = $p + $s;
             $length += $p + $s - $q;
             $included[$key] = $p + 1;
diff --git a/core/modules/search/search.test b/core/modules/search/search.test
index f121abd..73c6fe8
--- a/core/modules/search/search.test
+++ b/core/modules/search/search.test
@@ -1623,6 +1623,88 @@ class SearchExcerptTestCase extends DrupalUnitTestCase {
 }
 
 /**
+ * Tests the search_excerpt() function does not truncate or corrupt multi-byte sequences
+ */
+class SearchMultibyteTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Search excerpt multibyte truncation',
+      'description' => 'Tests that search result excerpts do not truncate or corrupt multi-byte sequences.',
+      'group' => 'Search',
+    );
+  }
+
+  function setUp() {
+    drupal_load('module', 'search');
+    parent::setUp('search');
+  }
+
+  /**
+   * Test that multibyte encodings in the node body are not corrupted in search excerpts.
+   */
+  function testMultibyteExcerpts() {
+    // Login with sufficient privileges.
+    $this->drupalLogin($this->drupalCreateUser(array('create page content', 'search content')));
+
+    // 10 tests is usually sufficient to cause the bug several times.
+    $numTests = 25;
+
+    $node = array(
+      'type' => 'page',
+      'title' => 'Test Node with Multibyte Encodings'
+    );
+    // These entities all render to multi-byte sequences, which if truncated
+    // will be a corrupt string and cause an empty search excerpt.
+    $mb_entities = array('&lsquo;', '&rsquo;', '&ldquo;', '&rdquo;', '&rsaquo;', '&lsaquo;');
+    $bodies = array();
+    // Create $numTests nodes containing random multibyte encodings and a
+    // keyword.  Each node body has 10-25 "words" consisting of a multi
+    // byte entity above and a space.  Somewhere amongst words 5-20 we
+    // place a search keyword.
+    for ($i = 0 ; $i < $numTests ; $i++) {
+      $body = '';
+      // the search keyword
+      $keyword = 'Search_'. $i;
+      // number of words (10-25). Each word is a random entity.
+      $words = rand(11,25);
+      // where to stick the keyword amongst the entity words
+      $keyword_pos = rand(5,10);
+      for ($j = 0 ; $j < $words ; $j++) {
+        if ($j == $keyword_pos) {
+          // hide the search keyword in the body
+          $body .= " $keyword ";
+        }
+        // each "word" is a multibyte entity
+        $body .= ' '. $mb_entities[rand(0,5)] . ' ';
+      }
+      $node['body'] = array(LANGUAGE_NONE => array(array('value' => $body)));
+      $bodies[$i] = $body;
+      $this->drupalCreateNode($node);
+    }
+
+    // Update the search index.
+    module_invoke_all('update_index');
+    search_update_totals();
+
+    // Refresh variables after the treatment.
+    $this->refreshVariables();
+
+    // Test that each node has a valid search excerpt and not an empty string,
+    // by looking for the existance of the search keyword in the page.
+    for ($i = 0 ; $i < $numTests ; $i++) {
+      $keyword = 'Search_'. $i;  // the search keyword
+      $edit = array('keys' => $keyword);;
+      $this->drupalPost('search/node', $edit, t('Search'));
+      if (!$this->assertText($keyword, 'Test search results exist for keyword Search_'.
+              (string)$i .' ('. (string)($i + 1) .'/'. (string)$numTests .').')) {
+        $this->verbose('Node body that fails for Search_'. (string)$i .' is: ['.
+                       str_replace('&','&amp;',$bodies[$i]) .']');
+      }
+    }
+  }
+}
+
+/**
  * Test the CJK tokenizer.
  */
 class SearchTokenizerTestCase extends DrupalWebTestCase {
