Skip to content

Commit

Permalink
Fixes evilsocket#2 by gracefully handling UnicodeEncodeError exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Sep 24, 2017
1 parent 86c783f commit a0c47ca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions bleah/scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ def handleDiscovery(self, dev, isNewDev, isNewData):

# short local name or complete local name
elif tag in [8, 9]:
tdata.append([ desc, yellow( val.decode('utf-8') ) ])

try:
tdata.append([ desc, yellow( val.decode('utf-8') ) ])
except UnicodeEncodeError:
tdata.append([ desc, yellow( repr(val) ) ])
else:
tdata.append([ desc, repr(val) ])

Expand Down

0 comments on commit a0c47ca

Please sign in to comment.