From d5916c06fba9667911a19cf658e7c5ab54daf72c Mon Sep 17 00:00:00 2001 From: albert-github Date: Sat, 20 Jun 2020 10:46:25 +0200 Subject: Problem with generating test output for Chinese (#7862) * Problem with generating test output for Chinese The log output generated for the Chinese language can contain some extended ASCII characters, this results in a message like: ``` UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf4 in position 36101: invalid continuation byte ``` and a crash of the test application during the read of the file. In case of a crash it is attempted to open the file with another decoding and redo the read. * Problem with generating test output for Chinese It is not necessary to use the fallback, one can, in this case, directly use `encoding='ISO-8859-1'` --- testing/runtests.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testing/runtests.py b/testing/runtests.py index 5d5cee1..c7b7bc7 100755 --- a/testing/runtests.py +++ b/testing/runtests.py @@ -391,10 +391,10 @@ class Tester: elif (not outType and xopen(latex_output + "/temp",'r').read().find("Error")!= -1): msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) failed_latex=True - elif xopen(latex_output + "/refman.log",'r').read().find("Error")!= -1: + elif xopen(latex_output + "/refman.log",'r',encoding='ISO-8859-1').read().find("Error")!= -1: msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) failed_latex=True - elif xopen(latex_output + "/refman.log",'r').read().find("Emergency stop")!= -1: + elif xopen(latex_output + "/refman.log",'r',encoding='ISO-8859-1').read().find("Emergency stop")!= -1: msg += ("PDF generation failed\n For a description of the problem see 'refman.log' in the latex directory of this test",) failed_latex=True elif not self.args.keep: -- cgit v0.12