Skip to content

Commit a00f988

Browse files
author
Tony Crisci
authored
Merge pull request #49 from minus7/patch-1
Robustness towards UTF-8 decoding errors
2 parents e0cb3e3 + 2bc145d commit a00f988

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

i3ipc/i3ipc.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ def _unpack(self, data):
206206
msg_magic, msg_length, msg_type = self._unpack_header(data)
207207
msg_size = self._struct_header_size + msg_length
208208
# XXX: Message shouldn't be any longer than the data
209-
return data[self._struct_header_size:msg_size].decode('utf-8')
209+
payload = data[self._struct_header_size:msg_size]
210+
return payload.decode('utf-8', 'replace')
210211

211212
def _unpack_header(self, data):
212213
"""

0 commit comments

Comments
 (0)