Skip to content

Commit

Permalink
Merge pull request #37727 from iarspider/patch-5
Browse files Browse the repository at this point in the history
cppCommentSkipper: catch UnicodeDecodeError and print file name
  • Loading branch information
cmsbuild committed Apr 29, 2022
2 parents 233757e + 802568e commit 53e54d4
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -12,8 +12,11 @@ def filterFiles(fileList):
return files

def filterFile(file): #ifstream& input)

lines = open(file).readlines()
try:
lines = open(file).readlines()
except UnicodeDecodeError as e:
print("CppCommentSkipper: WARNING: Invalid UTF-8 sequence in {0}: {1}".format(file, e.message))
lines = open(file, errors='replace').readlines()
commentStage = False

for i in range(len(lines)):
Expand Down

0 comments on commit 53e54d4

Please sign in to comment.