diff options
Diffstat (limited to 'Lib/UserString.py')
-rwxr-xr-x | Lib/UserString.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/UserString.py b/Lib/UserString.py index 163faa5..45cdeb5 100755 --- a/Lib/UserString.py +++ b/Lib/UserString.py @@ -72,6 +72,14 @@ class UserString: def center(self, width): return self.__class__(self.data.center(width)) def count(self, sub, start=0, end=sys.maxint): return self.data.count(sub, start, end) + def decode(self, encoding=None, errors=None): # XXX improve this? + if encoding: + if errors: + return self.__class__(self.data.decode(encoding, errors)) + else: + return self.__class__(self.data.decode(encoding)) + else: + return self.__class__(self.data.decode()) def encode(self, encoding=None, errors=None): # XXX improve this? if encoding: if errors: |