diff options
Diffstat (limited to 'pyload/utils')
-rw-r--r-- | pyload/utils/__init__.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/pyload/utils/__init__.py b/pyload/utils/__init__.py index 004274c3e..39a3ae751 100644 --- a/pyload/utils/__init__.py +++ b/pyload/utils/__init__.py @@ -8,6 +8,7 @@ import time import re from os.path import join from string import maketrans +from urllib import unquote from htmlentitydefs import name2codepoint # abstraction layer for json operations @@ -58,7 +59,7 @@ def remove_chars(string, repl): def safe_filename(name): """ remove bad chars """ - name = name.encode('ascii', 'replace') # Non-ASCII chars usually breaks file saving. Replacing. + name = unquote(name).encode('ascii', 'replace') # Non-ASCII chars usually breaks file saving. Replacing. if os.name == 'nt': return remove_chars(name, u'\00\01\02\03\04\05\06\07\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31\32' u'\33\34\35\36\37/?%*|"<>') @@ -84,7 +85,7 @@ def save_join(*args): if sys.getfilesystemencoding().startswith('ANSI'): def fs_encode(string): - return save_path(encode(string)) + return safe_filename(encode(string)) fs_decode = decode #decode utf8 |