From 7683867a4edfb5f172af3cf06d32d0161d40a305 Mon Sep 17 00:00:00 2001 From: Sergey Kolosovskiy Date: Wed, 16 Nov 2016 20:01:18 +0200 Subject: [PATCH] Fixed exceprion occurred when filenames contain russian letters --- lib/pyrrent2http/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pyrrent2http/util.py b/lib/pyrrent2http/util.py index e548b16..c624a49 100644 --- a/lib/pyrrent2http/util.py +++ b/lib/pyrrent2http/util.py @@ -56,7 +56,7 @@ def encode_msg(msg): def localize_path(path): if not isinstance(path, unicode): path = path.decode(chardet.detect(path)['encoding']) if not sys.platform.startswith('win'): - path = path.encode(sys.getfilesystemencoding() != 'ascii' and sys.getfilesystemencoding() or 'utf-8') + path = path.encode((sys.getfilesystemencoding() not in ('ascii', 'ANSI_X3.4-1968')) and sys.getfilesystemencoding() or 'utf-8') return path def can_bind(host, port):