mirror of
https://github.com/QingdaoU/JudgeServer.git
synced 2024-12-28 04:51:44 +00:00
fix encoding
This commit is contained in:
parent
cee8831690
commit
dca5db7348
@ -14,7 +14,6 @@ services:
|
||||
- /tmp
|
||||
- /judger_run:exec,mode=777
|
||||
- /spj:exec,mode=777
|
||||
- /dev/shm:mode=777
|
||||
volumes:
|
||||
- $PWD/tests/test_case:/test_case:ro
|
||||
- $PWD/log:/log
|
||||
|
1
server/.python-version
Normal file
1
server/.python-version
Normal file
@ -0,0 +1 @@
|
||||
3.6.2
|
@ -34,7 +34,7 @@ class Compiler(object):
|
||||
|
||||
if result["result"] != _judger.RESULT_SUCCESS:
|
||||
if os.path.exists(compiler_out):
|
||||
with open(compiler_out) as f:
|
||||
with open(compiler_out, encoding="utf-8") as f:
|
||||
error = f.read().strip()
|
||||
os.remove(compiler_out)
|
||||
if error:
|
||||
|
@ -56,7 +56,7 @@ class JudgeClient(object):
|
||||
|
||||
def _compare_output(self, test_case_file_id):
|
||||
user_output_file = os.path.join(self._submission_dir, str(test_case_file_id) + ".out")
|
||||
with open(user_output_file, "r") as f:
|
||||
with open(user_output_file, "r", encoding="utf-8") as f:
|
||||
content = f.read()
|
||||
output_md5 = hashlib.md5(content.rstrip().encode("utf-8")).hexdigest()
|
||||
result = output_md5 == self._get_test_case_file_info(test_case_file_id)["stripped_output_md5"]
|
||||
@ -141,7 +141,7 @@ class JudgeClient(object):
|
||||
|
||||
if self._output:
|
||||
try:
|
||||
with open(user_output_file, "r") as f:
|
||||
with open(user_output_file, "r", encoding="utf-8") as f:
|
||||
run_result["output"] = f.read()
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -66,7 +66,7 @@ class JudgeServer:
|
||||
src_path = os.path.join(submission_dir, compile_config["src_name"])
|
||||
|
||||
# write source code into file
|
||||
with open(src_path, "w") as f:
|
||||
with open(src_path, "w", encoding="utf-8") as f:
|
||||
f.write(src)
|
||||
|
||||
# compile source code, return exe file path
|
||||
@ -75,7 +75,7 @@ class JudgeServer:
|
||||
output_dir=submission_dir)
|
||||
else:
|
||||
exe_path = os.path.join(submission_dir, run_config["exe_name"])
|
||||
with open(exe_path, "w") as f:
|
||||
with open(exe_path, "w", encoding="utf-8") as f:
|
||||
f.write(src)
|
||||
|
||||
judge_client = JudgeClient(run_config=language_config["run"],
|
||||
@ -100,7 +100,7 @@ class JudgeServer:
|
||||
|
||||
# if spj source code not found, then write it into file
|
||||
if not os.path.exists(spj_src_path):
|
||||
with open(spj_src_path, "w") as f:
|
||||
with open(spj_src_path, "w", encoding="utf-8") as f:
|
||||
f.write(src)
|
||||
try:
|
||||
Compiler().compile(compile_config=spj_compile_config,
|
||||
|
1
tests/test_case/unicode/1.in
Normal file
1
tests/test_case/unicode/1.in
Normal file
@ -0,0 +1 @@
|
||||
你好,世界
|
1
tests/test_case/unicode/1.out
Normal file
1
tests/test_case/unicode/1.out
Normal file
@ -0,0 +1 @@
|
||||
你好,世界
|
12
tests/test_case/unicode/info
Normal file
12
tests/test_case/unicode/info
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"spj": false,
|
||||
"test_cases": {
|
||||
"1": {
|
||||
"stripped_output_md5": "dbefd3ada018615b35588a01e216ae6e",
|
||||
"input_size": 16,
|
||||
"output_size": 16,
|
||||
"input_name": "1.in",
|
||||
"output_name": "1.out"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user