From 6c2bf1e2f0a433f220e117043ea9f1bf9dd66f03 Mon Sep 17 00:00:00 2001 From: KarthikNambiar04 Date: Thu, 17 Sep 2026 14:16:30 +0530 Subject: [PATCH] tmax: decode taxonomy.json and template_prompt.md as UTF-8 Both are read via importlib.resources.files(...).read_text() with no explicit encoding, so Python falls back to the locale's preferred encoding. On Windows that's cp1252, not UTF-8, and template_prompt.md's prose contains bytes cp1252 can't map (e.g. a right single quotation mark), crashing every call with UnicodeDecodeError. Same bug class as #115, different call shape (importlib.resources vs subprocess) so outside that PR's scope. --- src/repo2rlenv/pipelines/recipes/tmax/sampler.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/repo2rlenv/pipelines/recipes/tmax/sampler.py b/src/repo2rlenv/pipelines/recipes/tmax/sampler.py index fcd24ef3..2d1f9c3a 100644 --- a/src/repo2rlenv/pipelines/recipes/tmax/sampler.py +++ b/src/repo2rlenv/pipelines/recipes/tmax/sampler.py @@ -76,11 +76,11 @@ def sample_inputs(path: Path) -> list[dict]: def template_prompt(seed: dict) -> str: - data = json.loads(files(__package__).joinpath("taxonomy.json").read_text()) + data = json.loads(files(__package__).joinpath("taxonomy.json").read_text(encoding="utf-8")) return ( files(__package__) .joinpath("template_prompt.md") - .read_text() + .read_text(encoding="utf-8") .replace("{{domain_label}}", seed["domain"].replace("_", " ").title()) .replace("{{module}}", data["DOMAIN_MODULES"][seed["domain"]]) .replace("{{v2_block}}", "")