fix(profiles): pass encoding=utf-8 to distribution.yaml open (#22083)

_distribution_metadata() reads the profile's distribution.yaml without
an explicit encoding, which defaults to the platform's locale encoding
— UTF-8 on POSIX, cp1252/mbcs on Windows. Files round-tripped between
hosts get mojibake on the Windows side.

Single-line fix: add encoding='utf-8' to the open() call. Matches the
sibling _read_config_model() site at line 398, which already does this.

Surfaces once PR #21561 lands the blocking ruff-check CI job
(PLW1514 — unspecified-encoding), but the underlying bug is
pre-existing on main.
This commit is contained in:
Teknium 2026-05-08 14:24:36 -07:00 committed by GitHub
parent 242da9db96
commit ea2cc4f902
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -375,7 +375,7 @@ def _read_distribution_meta(profile_dir: Path) -> tuple:
return None, None, None
try:
import yaml
with open(mf_path, "r") as f:
with open(mf_path, "r", encoding="utf-8") as f:
data = yaml.safe_load(f) or {}
if not isinstance(data, dict):
return None, None, None