mirror of
https://github.com/huashengdun/webssh.git
synced 2026-08-20 04:36:42 +00:00
Set utf-8 as the default encoding if we cannot detect it
This commit is contained in:
+10
-6
@@ -427,12 +427,16 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler):
|
||||
]
|
||||
|
||||
for command in commands:
|
||||
_, stdout, _ = ssh.exec_command(command, get_pty=True)
|
||||
data = stdout.read()
|
||||
logging.debug('{!r} => {!r}'.format(command, data))
|
||||
result = self.parse_encoding(data)
|
||||
if result:
|
||||
return result
|
||||
try:
|
||||
_, stdout, _ = ssh.exec_command(command, get_pty=True)
|
||||
except paramiko.SSHException as exc:
|
||||
logging.info(str(exc))
|
||||
else:
|
||||
data = stdout.read()
|
||||
logging.debug('{!r} => {!r}'.format(command, data))
|
||||
result = self.parse_encoding(data)
|
||||
if result:
|
||||
return result
|
||||
|
||||
logging.warn('Could not detect the default ecnoding.')
|
||||
return 'utf-8'
|
||||
|
||||
Reference in New Issue
Block a user