Collator.lstripwords: Strip words off the start and append to the end.
[python-collate.git] / collate / syslocale.py
index 5b8adca..e48ee82 100644 (file)
@@ -25,7 +25,6 @@ Avoid this backend if...
 __all__ = ["Collator"]
 
 import locale
-import re
 
 import collate.errors
 import collate._abcollator
@@ -54,12 +53,5 @@ class Collator(collate._abcollator.Collator):
         """
         try:
             return locale.strxfrm(string)
-        except UnicodeEncodeError:
-            return locale.strxfrm(string.encode(self.encoding, "replace"))
-
-    def words(self, string, sep=re.compile(r"\W+", re.UNICODE)):
-        """Split the string into separate words."""
-        if isinstance(string, str):
-            string = string.decode(self.encoding, 'replace')
-        return re.split(sep, string)
-
+        except UnicodeError:
+            return locale.strxfrm(string.str(self.encoding))