From 38631e3c24e96bf80250562da99bfcdb8e308bbe Mon Sep 17 00:00:00 2001 From: LB <78799392+lbam@users.noreply.github.com> Date: Tue, 15 Aug 2023 12:57:00 +0200 Subject: [PATCH] Make make_indexjson more robust (#389) Didn't handle single quotes gracefully and ran into some encoding issue on ACC. --- tools/make_indexjson.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/make_indexjson.py b/tools/make_indexjson.py index 61268aee..b62db8d1 100644 --- a/tools/make_indexjson.py +++ b/tools/make_indexjson.py @@ -28,7 +28,7 @@ def parse_mapfile(filename: str) -> Tuple[str, Dict[str, object]]: # mapfiles would be cleaner, but mappyfile doesn't support the full mapfile # grammar, so we'd need this as a fallback anyway. r = {} - with open(filename) as f: + with open(filename, encoding="utf-8") as f: for ln in f: ln = ln.split() if len(ln) == 0: @@ -39,7 +39,7 @@ def parse_mapfile(filename: str) -> Tuple[str, Dict[str, object]]: continue value = ln[1] - if value.startswith('"'): + if value.startswith('"') or value.startswith("'"): value = value[1:-1] r.setdefault(key, value)