Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.54
diff -u -p -r1.54 pathauto.inc
--- pathauto.inc	22 Oct 2009 00:11:35 -0000	1.54
+++ pathauto.inc	23 Oct 2009 16:14:11 -0000
@@ -234,15 +234,11 @@ function pathauto_cleanstring($string, $
   // Always replace whitespace with the separator.
   $output = preg_replace('/\s+/', $separator, $output);
 
-  // In preparation for pattern matching,
-  // escape the separator if and only if it is not alphanumeric.
-  if (isset($separator)) {
-    if (preg_match('/^[^'. PREG_CLASS_ALNUM .']+$/uD', $separator)) {
-      $seppattern = $separator;
-    }
-    else {
-      $seppattern = '\\'. $separator;
-    }
+  // Clean duplicate or trailing separators.
+  if (strlen($separator)) {
+    // Escape the separator.
+    $seppattern = preg_quote($separator, '/');
+
     // Trim any leading or trailing separators.
     $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
 
@@ -251,11 +247,11 @@ function pathauto_cleanstring($string, $
 
     // Replace multiple separators with a single one.
     $output = preg_replace("/$seppattern+/", "$separator", $output);
+  }
 
-    // Optionally convert to lower case.
-    if (variable_get('pathauto_case', PATHAUTO_CASE_LOWER)) {
-      $output = drupal_strtolower($output);
-    }
+  // Optionally convert to lower case.
+  if (variable_get('pathauto_case', PATHAUTO_CASE_LOWER)) {
+    $output = drupal_strtolower($output);
   }
 
   // Enforce the maximum component length
