From 7405827fb9e5c2d7295e8fa5cbf6cec209422d5e Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Wed, 25 Mar 2015 17:00:28 +0100 Subject: [PATCH] Use sys.getfilesystemencoding() to encode Unicode file names --- soundfile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soundfile.py b/soundfile.py index 8580c54..c9696d0 100644 --- a/soundfile.py +++ b/soundfile.py @@ -12,6 +12,7 @@ import numpy as _np import os as _os +import sys as _sys from cffi import FFI as _FFI from os import SEEK_SET, SEEK_CUR, SEEK_END @@ -681,7 +682,7 @@ def __init__(self, file, mode='r', samplerate=None, channels=None, self._name = file if isinstance(file, _unicode): - file = file.encode() + file = file.encode(_sys.getfilesystemencoding()) if isinstance(file, bytes): if _os.path.isfile(file):