mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
Use UTF-8 for skill creator file I/O (#63343)
Python's default text encoding can vary by environment, causing non-ASCII skill text to be misread or fail to encode. Read `SKILL.md` as UTF-8 in both the validator and the metadata generator, and write `agents/openai.yaml` as UTF-8. GitOrigin-RevId: d21ad0c653056ec0517d95b7b18e77f66489a9a2
This commit is contained in:
@@ -106,7 +106,7 @@ def read_frontmatter_name(skill_dir):
|
||||
if not skill_md.exists():
|
||||
print(f"[ERROR] SKILL.md not found in {skill_dir}")
|
||||
return None
|
||||
content = skill_md.read_text()
|
||||
content = skill_md.read_text(encoding="utf-8")
|
||||
match = re.match(r"^---\n(.*?)\n---", content, re.DOTALL)
|
||||
if not match:
|
||||
print("[ERROR] Invalid SKILL.md frontmatter format.")
|
||||
@@ -187,7 +187,7 @@ def write_openai_yaml(skill_dir, skill_name, raw_overrides):
|
||||
agents_dir = Path(skill_dir) / "agents"
|
||||
agents_dir.mkdir(parents=True, exist_ok=True)
|
||||
output_path = agents_dir / "openai.yaml"
|
||||
output_path.write_text("\n".join(interface_lines) + "\n")
|
||||
output_path.write_text("\n".join(interface_lines) + "\n", encoding="utf-8")
|
||||
print(f"[OK] Created agents/openai.yaml")
|
||||
return output_path
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ def validate_skill(skill_path):
|
||||
if not skill_md.exists():
|
||||
return False, "SKILL.md not found"
|
||||
|
||||
content = skill_md.read_text()
|
||||
content = skill_md.read_text(encoding="utf-8")
|
||||
if not content.startswith("---"):
|
||||
return False, "No YAML frontmatter found"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user