summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAetias <aetias@outlook.com>2025-02-05 16:48:26 +0100
committerAetias <aetias@outlook.com>2025-02-05 16:48:26 +0100
commit816c696255d4199ebbda20716b8e782701f048d8 (patch)
treede4db39e904f79f602ca7ef3512d948460efa183 /tools
parentc380ac51a48d17348b1cdcbb615ce22be22f409e (diff)
m2ctx.py: Specify input encoding
Diffstat (limited to 'tools')
-rwxr-xr-xtools/m2ctx.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/m2ctx.py b/tools/m2ctx.py
index f2275e33..7eef9bd7 100755
--- a/tools/m2ctx.py
+++ b/tools/m2ctx.py
@@ -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=args.encoding) 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)