diff options
author | 2012-01-22 12:40:52 +0100 | |
---|---|---|
committer | 2012-01-22 12:40:52 +0100 | |
commit | 8a691056ce894fcc562fddb642932338050645a6 (patch) | |
tree | b4eba4d4c5379d579d599326a6c47267d4e292e8 /module/utils/__init__.py | |
parent | Bring Oron's premium account handling to latest api. (diff) | |
parent | realdebrid encoding fix (diff) | |
download | pyload-8a691056ce894fcc562fddb642932338050645a6.tar.xz |
Merging encoding fixes from pyload
Diffstat (limited to 'module/utils/__init__.py')
-rw-r--r-- | module/utils/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/module/utils/__init__.py b/module/utils/__init__.py index bf11fbc69..592bdbd7e 100644 --- a/module/utils/__init__.py +++ b/module/utils/__init__.py @@ -19,6 +19,16 @@ def decode(string): except: 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: + return string + def remove_chars(string, repl): """ removes all chars in repl from string""" if type(string) == str: |