From 37ba2f62864c15cf5a883bad35fe853f82e91167 Mon Sep 17 00:00:00 2001 From: rocky Date: Thu, 29 Aug 2024 15:53:09 -0400 Subject: [PATCH] Use UTF-8 in reading... This effects operator and character table creation in mathics-core --- mathics_scanner/generate/build_operator_tables.py | 4 +++- mathics_scanner/generate/build_tables.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mathics_scanner/generate/build_operator_tables.py b/mathics_scanner/generate/build_operator_tables.py index ce4da3f..bc8a52b 100644 --- a/mathics_scanner/generate/build_operator_tables.py +++ b/mathics_scanner/generate/build_operator_tables.py @@ -74,7 +74,9 @@ def compile_tables(data: Dict[str, dict]) -> Dict[str, dict]: "data_dir", type=click.Path(readable=True), default=DEFAULT_DATA_DIR, required=False ) def main(output, data_dir): - with open(data_dir / "operators.yml", "r") as i, open(output, "w") as o: + with open(data_dir / "operators.yml", "r", encoding="utf8") as i, open( + output, "w" + ) as o: # Load the YAML data. data = yaml.load(i, Loader=yaml.FullLoader) diff --git a/mathics_scanner/generate/build_tables.py b/mathics_scanner/generate/build_tables.py index 930071c..78fb220 100755 --- a/mathics_scanner/generate/build_tables.py +++ b/mathics_scanner/generate/build_tables.py @@ -276,7 +276,9 @@ def compile_tables(data: dict) -> dict: "data_dir", type=click.Path(readable=True), default=DEFAULT_DATA_DIR, required=False ) def main(field, output, data_dir): - with open(data_dir / "named-characters.yml", "r") as i, open(output, "w") as o: + with open(data_dir / "named-characters.yml", "r", encoding="utf8") as i, open( + output, "w" + ) as o: # Load the YAML data. data = yaml.load(i, Loader=yaml.FullLoader)