Repository navigation
Description
What happens
On a Chinese-locale Windows console, tier1 (and anything else that prints a summary) ends with a UnicodeEncodeError traceback instead of a report. The summary stops mid-print, so the user gets no verdict.
$ skillevaluator tier1 skills/skillevaluator --no-llm
...
Summary:
Traceback (most recent call last):
...
File "skillevaluator/reporting/cli.py", line 558, in _print_summary_stats
console.print(f" \u2022 Errors: {error_detail}")
...
File "rich/_windows_renderer.py", line 19, in legacy_windows_render
term.write_text(text)
File "rich/_win32_console.py", line 402, in write_text
self.write(text)
UnicodeEncodeError: 'gbk' codec can't encode character '\u2022' in position 2: illegal multibyte sequence
Exit status is 1, so a CI gate still fails — but a developer running this locally sees a traceback and an incomplete report.
Why
reporting/cli.py prints a • bullet at six places in the summary path (:495, :546, :548, :558, :560, :593; • appears 12 times across src/). When stdout is a Windows console, rich takes the legacy path (legacy_windows_render) and writes through LegacyWindowsTerm, which encodes with the stream's encoding — cp936 on a Chinese Windows install. • (U+2022) is not in cp936, so the write raises.
The terminal's own setting does not help: [Console]::OutputEncoding was already utf-8 when this failed. The encoding that matters is Python's stdout encoding, which comes from the locale, not from the console code page.
Reproduced on
- Windows 11, Python 3.13.12,
cp936default encoding - Same traceback from
git-bashand from PowerShell, so it is not one shell's stdout wrapper skillevaluator tier1 skills/skillevaluator --no-llm(the repository's own skill as the target)
I did not test on Linux or macOS; both are unaffected as far as I can tell, since their default stdout encoding is UTF-8.
Two ways to fix it
-
One line at the CLI entry point — make stdout lossy instead of fatal, keeping the glyph where it can be represented:
if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(errors="replace")
U+2022 then becomes
?on cp936 and the report still prints. This covers every rich render path, not just the six bullets. -
Drop the bullets from
reporting/cli.py— replace•with-. Smaller blast radius, no change to stream configuration, but the summary looks different for everyone.
Option 1 seems closer to the intent (the bullets are deliberate), and it also protects any future non-cp936-representable character in report text — a skill name or finding message can carry one just as easily as a literal bullet can.
Happy to open a PR for either if you want one; I did not want to change output encoding behaviour without your call on which approach fits the project.
Activity