Addresses re-review: the short-circuit normalized only hyphens, so an
encoding reported as 'utf_8' (underscore) still triggered an unnecessary
reconfigure(). Normalize underscores too, and add coverage for the utf-8 /
utf_8 / UTF8 spellings vs cp1252.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Never raise from stream reconfigure (wrap in try/except); a stream that
exposes an incompatible reconfigure() no longer aborts startup.
- Skip streams already encoded as UTF-8 so redirected output is not needlessly
re-encoded, while cp1252 consoles and cp1252 file redirects are still fixed.
- Drop the unused 'script' parametrization on the arrow-output test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Progress output contains arrow and box-drawing characters (e.g. the
'[2/6 REFLECT] failure=0->0 groups' line and the banner rules). On a Windows
console that defaults to cp1252, writing them raises UnicodeEncodeError and
kills the process partway through a run -- after rollouts and reflect calls
have already been paid for.
Both entry points now reconfigure stdout/stderr to UTF-8 with errors='replace'
at import time, guarded by hasattr so redirected or exotic streams are left
alone.