From cba56c6859eace6fbcabf0690f388ceeabd8c689 Mon Sep 17 00:00:00 2001 From: zoidberg10 Date: Mon, 5 Dec 2011 16:49:19 +0100 Subject: fix filesystem encoding issues on windows and synology nas --- module/Utils.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'module/Utils.py') diff --git a/module/Utils.py b/module/Utils.py index 955d14b27..f626eef10 100644 --- a/module/Utils.py +++ b/module/Utils.py @@ -47,21 +47,19 @@ def save_join(*args): if i: path = path.replace(":", "") - path = decode(path) - - tmp = fs_encode(path) - paths.append(tmp) + paths.append(unicode(path)) return join(*paths) def fs_encode(string): - """ Encodes with filesystem encoding + """ Encodes string with utf-8 if locale support seems to be missing :param string: string to decode :return: """ - try: - return string.encode(sys.getfilesystemencoding(), "replace") - except: + try: + if sys.getfilesystemencoding() == 'ANSI_X3.4-1968': + string = string.encode('utf-8') + finally: return string def fs_decode(string): -- cgit v1.2.3