Latex解除非UTF8编码错误

This commit is contained in:
qingxu fu 2023-07-18 11:00:20 +08:00
parent 3002c6318a
commit eef9e470c9

View File

@ -147,7 +147,7 @@ def 寻找Latex主文件(file_manifest, mode):
for texf in file_manifest: for texf in file_manifest:
if os.path.basename(texf).startswith('merge'): if os.path.basename(texf).startswith('merge'):
continue continue
with open(texf, 'r', encoding='utf8') as f: with open(texf, 'r', encoding='utf8', errors='ignore') as f:
file_content = f.read() file_content = f.read()
if r'\documentclass' in file_content: if r'\documentclass' in file_content:
canidates.append(texf) canidates.append(texf)
@ -165,7 +165,7 @@ def 寻找Latex主文件(file_manifest, mode):
expected_words = ['\input', '\ref', '\cite'] expected_words = ['\input', '\ref', '\cite']
for texf in canidates: for texf in canidates:
canidates_score.append(0) canidates_score.append(0)
with open(texf, 'r', encoding='utf8') as f: with open(texf, 'r', encoding='utf8', errors='ignore') as f:
file_content = f.read() file_content = f.read()
for uw in unexpected_words: for uw in unexpected_words:
if uw in file_content: if uw in file_content: