mirror of https://github.com/jumpserver/jumpserver
install_chardet
parent
d48020a919
commit
9b3a51469e
|
@ -10,7 +10,7 @@ import os.path
|
||||||
import threading
|
import threading
|
||||||
import re
|
import re
|
||||||
import functools
|
import functools
|
||||||
|
import chardet
|
||||||
from django.core.signals import request_started, request_finished
|
from django.core.signals import request_started, request_finished
|
||||||
|
|
||||||
import tornado.ioloop
|
import tornado.ioloop
|
||||||
|
@ -412,6 +412,9 @@ class WebTerminalHandler(tornado.websocket.WebSocketHandler):
|
||||||
if self.term.vim_flag:
|
if self.term.vim_flag:
|
||||||
self.term.vim_data += recv
|
self.term.vim_data += recv
|
||||||
try:
|
try:
|
||||||
|
print chardet.detect(data)
|
||||||
|
if chardet.detect(data).encoding == 'GB2312':
|
||||||
|
data = data.encode('gbk').decode('utf8')
|
||||||
self.write_message(data)
|
self.write_message(data)
|
||||||
now_timestamp = time.time()
|
now_timestamp = time.time()
|
||||||
self.log_time_f.write('%s %s\n' % (round(now_timestamp-pre_timestamp, 4), len(data)))
|
self.log_time_f.write('%s %s\n' % (round(now_timestamp-pre_timestamp, 4), len(data)))
|
||||||
|
|
Loading…
Reference in New Issue