summaryrefslogtreecommitdiffstats
path: root/module/Utils.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-15 18:53:49 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-06-15 18:53:49 +0200
commit8d8e5738073d1726ace7d19589b9c6529b8b30ad (patch)
tree8e3fdd1c3cdbb2cbe42d5fbcfa4837801c563fb3 /module/Utils.py
parenthtml_unescape function, little plugin improvements (diff)
downloadpyload-8d8e5738073d1726ace7d19589b9c6529b8b30ad.tar.xz
fixes some encoding issues
Diffstat (limited to 'module/Utils.py')
-rw-r--r--module/Utils.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/module/Utils.py b/module/Utils.py
index cdf76c144..45fa81d52 100644
--- a/module/Utils.py
+++ b/module/Utils.py
@@ -43,10 +43,31 @@ def save_join(*args):
path = decode(path)
- tmp = path.encode(sys.getfilesystemencoding(), "replace")
+ tmp = fs_encode(path)
paths.append(tmp)
return join(*paths)
+def fs_encode(string):
+ """ Encodes with filesystem encoding
+
+ :param string: string to decode
+ :return:
+ """
+ try:
+ return string.encode(sys.getfilesystemencoding(), "replace")
+ except:
+ return string
+
+def fs_decode(string):
+ """ Decodes with filesystem encoding
+
+ :param string: string to decode
+ :return:
+ """
+ try:
+ return string.decode(sys.getfilesystemencoding(), "replace")
+ except:
+ return string
def compare_time(start, end):
start = map(int, start)