aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/cmake/fileapi.py
diff options
context:
space:
mode:
authorDaniel Mensinger <daniel@mensinger-ka.de>2021-06-22 22:59:16 +0200
committerDaniel Mensinger <daniel@mensinger-ka.de>2021-06-29 11:28:08 +0200
commit3e396b3782813d36d46195564cd0e111422bcaf5 (patch)
treef315e990f71984745fcb8f22dac2f0e400fecadb /mesonbuild/cmake/fileapi.py
parent28175bbee2c111cf41b80c97bbadd7dbabaa8990 (diff)
downloadmeson-3e396b3782813d36d46195564cd0e111422bcaf5.zip
meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.gz
meson-3e396b3782813d36d46195564cd0e111422bcaf5.tar.bz2
fix: Always explicitly set encoding for text files (fixes #8263)
Diffstat (limited to 'mesonbuild/cmake/fileapi.py')
-rw-r--r--mesonbuild/cmake/fileapi.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/mesonbuild/cmake/fileapi.py b/mesonbuild/cmake/fileapi.py
index 6773e9a..5d4d01a 100644
--- a/mesonbuild/cmake/fileapi.py
+++ b/mesonbuild/cmake/fileapi.py
@@ -51,7 +51,7 @@ class CMakeFileAPI:
}
query_file = self.request_dir / 'query.json'
- query_file.write_text(json.dumps(query, indent=2))
+ query_file.write_text(json.dumps(query, indent=2), encoding='utf-8')
def load_reply(self) -> None:
if not self.reply_dir.is_dir():
@@ -75,7 +75,7 @@ class CMakeFileAPI:
# Debug output
debug_json = self.build_dir / '..' / 'fileAPI.json'
debug_json = debug_json.resolve()
- debug_json.write_text(json.dumps(index, indent=2))
+ debug_json.write_text(json.dumps(index, indent=2), encoding='utf-8')
mlog.cmd_ci_include(debug_json.as_posix())
# parse the JSON
@@ -313,7 +313,7 @@ class CMakeFileAPI:
if not real_path.exists():
raise CMakeException(f'File "{real_path}" does not exist')
- data = json.loads(real_path.read_text())
+ data = json.loads(real_path.read_text(encoding='utf-8'))
assert isinstance(data, dict)
for i in data.keys():
assert isinstance(i, str)