From 3e3a533f1b88d6265fc3c2fab4636331ac201ed8 Mon Sep 17 00:00:00 2001 From: tejas Date: Wed, 19 Mar 2025 13:12:41 +0100 Subject: [PATCH] handle unicodes by setting ensure_ascii=False in json.dumps --- deep_code/utils/github_automation.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/deep_code/utils/github_automation.py b/deep_code/utils/github_automation.py index bdbae38..8090069 100644 --- a/deep_code/utils/github_automation.py +++ b/deep_code/utils/github_automation.py @@ -88,10 +88,12 @@ def add_file(self, file_path: str, content): if not isinstance(content, (dict, list, str, int, float, bool, type(None))): raise TypeError(f"Cannot serialize content of type {type(content)}") try: - json_content = json.dumps(content, indent=2, default=serialize) + json_content = json.dumps( + content, indent=2, ensure_ascii=False, default=serialize + ) except TypeError as e: raise RuntimeError(f"JSON serialization failed: {e}") - with open(full_path, "w") as f: + with open(full_path, "w", encoding="utf-8") as f: f.write(json_content) try: subprocess.run(["git", "add", str(full_path)], check=True)