Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

surrogateescape added #115

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions python3/pyinotify.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ def _inotify_add_watch(self, fd, pathname, mask):
# ctypes.create_string_buffer seems to manipulate bytes internally.
# Moreover it seems that inotify_add_watch does not work very well when
# it receives an ctypes.create_unicode_buffer instance as argument.
pathname = pathname.encode(sys.getfilesystemencoding())
pathname = pathname.encode(sys.getfilesystemencoding(), errors='surrogateescape')
pathname = ctypes.create_string_buffer(pathname)
return self._libc.inotify_add_watch(fd, pathname, mask)

Expand Down Expand Up @@ -1236,7 +1236,7 @@ def read_events(self):
bname, = struct.unpack('%ds' % fname_len,
r[rsum + s_size:rsum + s_size + fname_len])
# FIXME: should we explictly call sys.getdefaultencoding() here ??
uname = bname.decode()
uname = bname.decode(errors='surrogateescape')
rawevent = _RawEvent(wd, mask, cookie, uname)
if self._coalesce:
# Only enqueue new (unique) events.
Expand Down