Index: /Users/bevan/Sites/drupalhead/modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.897
diff -u -r1.897 node.module
--- node.module	28 Oct 2007 11:43:04 -0000	1.897
+++ node.module	5 Nov 2007 03:26:05 -0000
@@ -285,34 +285,42 @@
 
   // The teaser may not be longer than maximum length specified. Initial slice.
   $teaser = truncate_utf8($body, $size);
-  $position = 0;
-  // Cache the reverse of the teaser.
+
+  // Reset $size to the actual length of the UTF8 string -- which might not be 
+  // the same as $size.
+  $size = strlen($teaser);
+
+  // How much to cut off the end of body to make the teaser. Initialize it to
+  // the largest possible value.
+  $min_length = $size;
+
+  // Store the reverse of the teaser.  We use strpos on the reversed needle and
+  // haystack for speed.
   $reversed = strrev($teaser);
 
-  // In some cases, no delimiter has been specified. In this case, we try to
-  // split at paragraph boundaries.
-  $breakpoints = array('</p>' => 0, '<br />' => 6, '<br>' => 4, "\n" => 1);
-  // We use strpos on the reversed needle and haystack for speed.
-  foreach ($breakpoints as $point => $offset) {
+  // If the delimiter has not been specified, try to split at paragraph
+  // boundaries.
+  $line_breaks = array('</p>' => 0, '<br />' => 6, '<br>' => 4, "\n" => 1);
+  foreach ($line_breaks as $point => $offset) {
     $length = strpos($reversed, strrev($point));
     if ($length !== FALSE) {
-      $position = - $length - $offset;
-      return ($position == 0) ? $teaser : substr($teaser, 0, $position);
+      $min_length = min($length + $offset, $min_length);
     }
   }
 
-  // When even the first paragraph is too long, we try to split at the end of
-  // the last full sentence.
-  $breakpoints = array('. ' => 1, '! ' => 1, '? ' => 1, '。' => 0, '؟ ' => 1);
-  $min_length = strlen($reversed);
-  foreach ($breakpoints as $point => $offset) {
-    $length = strpos($reversed, strrev($point));
-    if ($length !== FALSE) {
-      $min_length = min($length, $min_length);
-      $position = 0 - $length - $offset;
+  // When the first paragraph is too long, we try to split at the end of the
+  // last full sentence.
+  if ($min_length == strlen($reversed)) {
+    $sentence_breaks = array('. ' => 1, '! ' => 1, '? ' => 1, '。' => 0, '؟ ' => 1);
+    foreach ($sentence_breaks as $point => $offset) {
+      $length = strpos($reversed, strrev($point));
+      if ($length !== FALSE) {
+        $min_length = min($length + $offset, $min_length);
+      }
     }
   }
-  return ($position == 0) ? $teaser : substr($teaser, 0, $position);
+  
+  return ($min_length == strlen($teaser)) ? $teaser : substr($teaser, 0, 0 - $min_length);
 }
 
 /**
