diff options
Diffstat (limited to 'pyload/utils')
| -rw-r--r-- | pyload/utils/__init__.py | 23 | 
1 files changed, 9 insertions, 14 deletions
| diff --git a/pyload/utils/__init__.py b/pyload/utils/__init__.py index ca00f9abe..da7b81af7 100644 --- a/pyload/utils/__init__.py +++ b/pyload/utils/__init__.py @@ -19,25 +19,20 @@ json_loads = json.loads  json_dumps = json.dumps  def decode(string): -    """ decode string with utf if possible """ -    try: -        if type(string) == str: -            return string.decode("utf8", "replace") -        else: -            return string -    except: +    """ decode string to unicode with utf8 """ +    if type(string) == str: +        return string.decode("utf8", "replace") +    else:          return string  def encode(string): -    """ decode string to utf if possible """ -    try: -        if type(string) == unicode: -            return string.encode("utf8", "replace") -        else: -            return string -    except: +    """ decode string to utf8 """ +    if type(string) == unicode: +        return string.encode("utf8", "replace") +    else:          return string +  def remove_chars(string, repl):      """ removes all chars in repl from string"""      if type(string) == str: | 
