Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a34597

Browse files
committed
Update sniff_x.py
selfspy#133 (comment)
1 parent b0be0ab commit 8a34597

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

selfspy/sniff_x.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,12 @@ def get_wm_name(self, win):
178178
if r:
179179
return r.decode('latin1') # WM_NAME with type=STRING.
180180
else:
181-
return d.value.decode('utf8')
181+
# Fixing utf8 issue on Ubuntu (https://github.com/gurgeh/selfspy/issues/133)
182+
# Thanks to https://github.com/gurgeh/selfspy/issues/133#issuecomment-142943681
183+
try:
184+
return d.value.decode('utf8')
185+
except UnicodeError:
186+
return d.value.encode('utf8').decode('utf8')
182187

183188
def get_cur_window(self):
184189
i = 0

0 commit comments

Comments
 (0)