#10247·agno

[Bug] yaml_io reads and writes files using the locale encoding instead of UTF-8

Author: MohammadHijjawi97Created Sep 17, 2026Updated Sep 17, 2026

Description

read_yaml_file and write_yaml_file call Path.read_text() / write_text() with no encoding, so they follow the locale. UTF-8 YAML with non-ASCII values fails on Windows cp1252.

Steps to Reproduce

  1. On a host whose preferred encoding is not UTF-8, write a UTF-8 YAML file containing café.
  2. Call read_yaml_file.
python
from pathlib import Path
from agno.utils.yaml_io import read_yaml_file

path = Path("cfg.yaml")
path.write_bytes("name: café\n".encode("utf-8"))
print(read_yaml_file(path))

Expected Behavior

The file is decoded as UTF-8 and returns {"name": "café"}.

Actual Behavior

UnicodeDecodeError (or a write-side UnicodeEncodeError when dumping unicode with allow_unicode=True).

Environment

  • OS: Windows 11
  • Agno Version: v3.0.10 (current main)
  • Additional Environment Details: Python 3.13, locale encoding cp1252

Possible Solutions (optional)

Pass encoding="utf-8" to both read_text and write_text.