From 5e48adcb9d44fcaaba95f23995356b5e565906e8 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Tue, 16 Aug 2022 09:27:05 +0200 Subject: [PATCH] scripts: Properly open legacy hexproj files as UTF-8 --- scripts/extract_legacy_hexproj.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/extract_legacy_hexproj.py b/scripts/extract_legacy_hexproj.py index 57279ab..7857715 100644 --- a/scripts/extract_legacy_hexproj.py +++ b/scripts/extract_legacy_hexproj.py @@ -4,7 +4,7 @@ from pathlib import Path def extractData(projectName, jsonData, objectName, extension): if objectName in jsonData: - with open(f"./{projectName}.{extension}", "w") as output: + with open(f"./{projectName}.{extension}", mode="w", encoding="utf-8") as output: output.write(jsonData[objectName]) def main(): @@ -13,7 +13,7 @@ def main(): exit(1) projectPath = sys.argv[1] - with open(projectPath, "r") as file: + with open(projectPath, mode="r", encoding="utf-8") as file: jsonData = json.loads(file.read()) projectName = Path(projectPath).stem @@ -22,7 +22,7 @@ def main(): extractData(projectName, jsonData, "pattern", "hexpat") if "bookmarks" in jsonData: - with open(f"./{projectName}.hexbm", "w") as output: + with open(f"./{projectName}.hexbm", mode="w", encoding="utf-8") as output: jsonOutput = {} jsonOutput["bookmarks"] = jsonData["bookmarks"] @@ -32,4 +32,4 @@ def main(): print(f"Project file used file {jsonData['filePath']}") if __name__ == "__main__": - main() \ No newline at end of file + main()