mirror of
https://github.com/xcat2/confluent.git
synced 2025-01-14 19:57:50 +00:00
Handle non-utf8 console data
Sometimes console uses non-utf8. Fallback to cp437 when utf8 fails us.
This commit is contained in:
parent
8397c5defc
commit
1f9c440525
@ -422,9 +422,11 @@ def wsock_handler(ws):
|
||||
if isinstance(data, dict):
|
||||
data = json.dumps(data)
|
||||
ws.send(u'!' + data)
|
||||
elif not isinstance(data, str):
|
||||
ws.send(u' ' + data.decode('utf8'))
|
||||
else:
|
||||
try:
|
||||
data = data.decode('utf8')
|
||||
except UnicodeDecodeError:
|
||||
data = data.decode('cp437')
|
||||
ws.send(u' ' + data)
|
||||
try:
|
||||
if shellsession:
|
||||
|
Loading…
x
Reference in New Issue
Block a user