File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -525,8 +525,10 @@ def get_submission(sid):
525525
526526 # the punctuations and newlines in the code are escaped like '\\u0010' ('\\' => real backslash)
527527 # to unscape the string, we do the trick '\\u0010'.encode().decode('unicode_escape') ==> '\n'
528- submission ['code' ] = _break_code_lines (_unescape (_group1 (
529- re .search ("submissionCode: '([^']*)'" , s ), '' )))
528+ # submission['code'] = _break_code_lines(_unescape(_group1(
529+ # re.search("submissionCode: '([^']*)'", s), '')))
530+ submission ['code' ] = _unescape_with_Chinese (
531+ _group1 (re .search ("submissionCode: '([^']*)'" , s ), '' ))
530532
531533 dist_str = _unescape (_group1 (re .search ("runtimeDistributionFormatted: '([^']*)'" , s ),
532534 '{"distribution":[]}' ))
@@ -765,5 +767,15 @@ def _echoerr(s):
765767 print (s )
766768
767769
770+ def _unescape_with_Chinese (code ) :
771+ for ch in set (re .findall (r'\\u\w{4}' , code )):
772+ print (ch )
773+ code = code .replace (ch , ch .encode ('utf-8' ).decode ('unicode_escape' ))
774+ log .info ("code is %s" , code )
775+ return code .splitlines ()
776+
777+
778+
779+
768780task_thread = Thread (target = _thread_main , daemon = True )
769781task_thread .start ()
You can’t perform that action at this time.
0 commit comments