From 9b3d6ccaf321a44a0f6b9570be099ec465f79faa Mon Sep 17 00:00:00 2001 From: RaNaN Date: Fri, 12 Jul 2013 13:39:54 +0200 Subject: working multihoster addon --- pyload/utils/__init__.py | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'pyload/utils/__init__.py') 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: -- cgit v1.2.3