aboutsummaryrefslogtreecommitdiffstats
path: root/library/python
diff options
context:
space:
mode:
Diffstat (limited to 'library/python')
-rw-r--r--library/python/fs/__init__.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/library/python/fs/__init__.py b/library/python/fs/__init__.py
index 86391afbe9..6b6a011e7f 100644
--- a/library/python/fs/__init__.py
+++ b/library/python/fs/__init__.py
@@ -290,7 +290,10 @@ def copy_tree(src, dst, copy_function=shutil.copy2):
# Throws OSError
@errorfix_win
def read_file(path, binary=True):
- with open(path, 'r' + ('b' if binary else '')) as f:
+ kwargs = {}
+ if not binary and six.PY3:
+ kwargs['encoding'] = sys.getfilesystemencoding()
+ with open(path, 'r' + ('b' if binary else ''), **kwargs) as f:
return f.read()