mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 06:21:45 +03:00
stop bad unicode data from crashing teh test harness
instead of exploding if monkey returns a bad unicode string instead a warning will be reported and the unicode decode performed with character replacemnt instead
This commit is contained in:
parent
bcc64cf263
commit
5632c9c8c0
@ -115,7 +115,11 @@ class MonkeyFarmer(asyncore.dispatcher):
|
||||
self.buffer += cmd.encode('utf-8')
|
||||
|
||||
def monkey_says(self, line):
|
||||
line = line.decode('utf-8')
|
||||
try:
|
||||
line = line.decode('utf-8')
|
||||
except UnicodeDecodeError:
|
||||
print("WARNING: Unicode decode error")
|
||||
line = line.decode('utf-8', 'replace')
|
||||
if not self.quiet:
|
||||
print("<<< {}".format(line))
|
||||
self.discussion.append(("<", line))
|
||||
|
Loading…
Reference in New Issue
Block a user