Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions problemtools/verifyproblem.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,13 @@ def __init__(self, problem: Problem, base: str, testcasegroup: TestCaseGroup):
problem.testcase_by_infile[self.infile] = self

def check_newlines(self, filename: str) -> None:
with open(filename, 'r') as f:
data = f.read()
with open(filename, 'rb') as f:
rawdata = f.read()
try:
data = rawdata.decode('utf-8', 'strict')
except UnicodeDecodeError:
self.warning(f'The file {filename} could not be decoded as utf-8')
return
if data.find('\r') != -1:
self.warning(f'The file {filename} contains non-standard line breaks.')
if len(data) > 0 and data[-1] != '\n':
Expand Down