Files
TrueGrowth/vendor/Agent-Reach/agent_reach/utils/text.py
Jammy 52636c91ae
Some checks failed
CI / main (push) Has been cancelled
CI / release-e2e (push) Has been cancelled
Track bundled vendor runtime sources
2026-07-07 10:05:50 +08:00

15 lines
391 B
Python

"""UTF-8-safe text helpers for cross-platform file operations."""
from __future__ import annotations
from pathlib import Path
def read_utf8_text(path: str | Path, default: str = "") -> str:
"""Read text as UTF-8 with replacement semantics."""
target = Path(path)
if not target.exists():
return default
return target.read_text(encoding="utf-8", errors="replace")