Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion rdagent/utils/agent/tpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,13 @@ def load_content(uri: str, caller_dir: Path | None = None, ftype: str = "yaml")
yaml_content = yaml_content[key]
return yaml_content

return file_path.read_text()
# Force UTF-8 so non-YAML templates (.md, .txt, .py, ...) decode
# consistently across platforms. Without an explicit encoding,
# ``Path.read_text`` falls back to ``locale.getpreferredencoding``,
# which is ``cp1252`` / ``gbk`` / etc on non-UTF-8 Windows hosts
# and raises ``UnicodeDecodeError`` on any non-ASCII byte the
# template happens to carry. Reported in issue #939.
return file_path.read_text(encoding="utf-8")
except FileNotFoundError:
continue # the file does not exist, so goto the next loop.
except KeyError:
Expand Down
Loading