__all__ = ["Collator"]
import locale
-import re
import collate.errors
import collate._abcollator
"""
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))