def words(self, string):
"""Split the string along word boundries."""
- if isinstance(string, str):
- string = string.decode(self.encoding)
- words = self._breaker.words(string)
- return [w for w in words if not w.isspace()]
+ string = self.unicode(string)
+ return self._breaker.words(string)
def key(self, string):
"""Sort key for a string.
instance according to the 'encoding' attribute of the
Collator.
"""
- if isinstance(string, str):
- string = string.decode(self.encoding, 'replace')
+ string = self.unicode(string)
return self._collator.key(string)