m2ctx.py: Read in UTF-8

This commit is contained in:
Aetias
2025-05-10 20:24:13 +02:00
parent 218dc0ea38
commit b4cd6ce4d7
+1 -1
View File
@@ -36,7 +36,7 @@ INCLUDE_REGEX = r'^\s*#\s*include\s*([<"][\S ]+[>"])\s*$'
# Finds all line comments and multiline comments
COMMENT_REGEX = r'\/\/.*$|\/\*(?:.|\r|\n)+?\*\/'
with open(args.file, 'r') as f:
with open(args.file, 'r', encoding="utf8") as f:
contents = f.read()
contents = re.sub(COMMENT_REGEX, '', contents, count=0, flags=re.MULTILINE)
includes = re.findall(INCLUDE_REGEX, contents, flags=re.MULTILINE)