Skip to content

Commit

Permalink
Merge pull request #46 from xiyangxixian/dev
Browse files Browse the repository at this point in the history
字符编码优化
  • Loading branch information
xiyangxixian authored Nov 26, 2018
2 parents 31bf2c4 + 5df12b0 commit ba6171a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def runcmd(cmd):
stderr=fileno,universal_newlines=True)
p.wait() # 如果超时直接干掉
out_temp.seek(0)
return out_temp.read().decode('utf8', 'ignore')
return out_temp.read().decode('utf8', 'replace')
except Exception as e:
# 异常信息会暴露一些系统位置等消息
return 'run error: %s' % str(e)
Expand Down Expand Up @@ -167,7 +167,7 @@ def soar_result(args):
loginfo = ''
if 'log-level' in args:
try:
with codecs.open(log_tmp_file, 'r', encoding='utf8', errors='ignore') as f:
with codecs.open(log_tmp_file, 'r', encoding='utf8', errors='replace') as f:
loginfo = f.read()
except:
pass
Expand Down

0 comments on commit ba6171a

Please sign in to comment.