Skip to content

fix: resolve charmap codec error in wmk analyze and wmk inspect on Windows#200

Merged
DingmaomaoBJTU merged 4 commits into
mainfrom
qiowu/fix_utf8
Apr 1, 2026
Merged

fix: resolve charmap codec error in wmk analyze and wmk inspect on Windows#200
DingmaomaoBJTU merged 4 commits into
mainfrom
qiowu/fix_utf8

Conversation

@DingmaomaoBJTU

@DingmaomaoBJTU DingmaomaoBJTU commented Apr 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes #191

  • Root cause (analyze): StaticAnalyzerConsoleWriter passed legacy_windows=False to Console(). This flag bypasses Rich's Win32 WriteConsoleW path and forces output through Python's IO layer, which on a default Windows console uses cp1252 — a codec that cannot encode any emoji or Unicode check marks. wmk perf and other commands use a plain Console() with no such flag, which is why they work fine.

  • Root cause (inspect): inspect/formatter.py uses /// as status icons; these are all outside cp1252 and crash even with the default Console path.

Fix:

  1. Remove legacy_windows=False (and the unrelated force_terminal=True) from StaticAnalyzerConsoleWriter — matching the pattern used by wmk perf.
  2. Replace all non-cp1252 symbols in analyze/console_writer.py, commands/analyze.py, and inspect/formatter.py with ASCII equivalents (+/x/!/?/-/*).
image

…ndows

Remove legacy_windows=False from StaticAnalyzerConsoleWriter — this flag
forces Rich to bypass Win32 console APIs and write through Python IO, which
triggers cp1252 UnicodeEncodeError on any non-ASCII character. With the
default Console() behaviour (matching wmk perf), Rich uses WriteConsoleW and
avoids codec issues entirely.

Replace non-ASCII symbols (emoji, check marks, arrows) in console_writer.py,
commands/analyze.py, and inspect/formatter.py with ASCII equivalents for the
same reason.

Closes #191
@DingmaomaoBJTU DingmaomaoBJTU requested a review from a team as a code owner April 1, 2026 02:04
Comment thread src/winml/modelkit/analyze/console_writer.py
@DingmaomaoBJTU DingmaomaoBJTU enabled auto-merge (squash) April 1, 2026 02:47
@DingmaomaoBJTU DingmaomaoBJTU merged commit 92325bf into main Apr 1, 2026
9 checks passed
@DingmaomaoBJTU DingmaomaoBJTU deleted the qiowu/fix_utf8 branch April 1, 2026 02:53
timenick added a commit that referenced this pull request Apr 1, 2026
Replace non-ASCII characters (→, •) with ASCII equivalents (->, *)
in optimize.py to prevent UnicodeEncodeError on Windows cp1252 consoles.
This was missed in #200 which applied the same fix to analyze and inspect.

Closes #207
timenick added a commit that referenced this pull request Apr 1, 2026
#208)

* fix: resolve charmap codec error in winml optimize on Windows

Replace non-ASCII characters (→, •) with ASCII equivalents (->, *)
in optimize.py to prevent UnicodeEncodeError on Windows cp1252 consoles.
This was missed in #200 which applied the same fix to analyze and inspect.

Closes #207

* fix: replace remaining non-ASCII chars in build, config, eval, live_chart, perf commands

Same charmap codec fix as optimize.py but for the other command files
that were missed: build.py, config.py, eval.py, live_chart.py, perf.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wmk analyze / wmk inspect: Windows console crashes with charmap codec error due to emoji in output

2 participants