diff options
Diffstat (limited to 'module/Utils.py')
-rw-r--r-- | module/Utils.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/module/Utils.py b/module/Utils.py index b023a981d..6f889118d 100644 --- a/module/Utils.py +++ b/module/Utils.py @@ -13,6 +13,13 @@ def chmod(*args): except: pass +def decode(string): + """ decode string with utf if possible """ + try: + return string.decode("utf8", "ignore") + except: + return string + def save_join(*args): """ joins a path, encoding aware """ paths = [] @@ -21,6 +28,8 @@ def save_join(*args): if i: path = path.replace(":","") + path = decode(path) + tmp = path.encode(sys.getfilesystemencoding(), "replace") paths.append(tmp) return join(*paths) |