fix: keep CLI status output usable under ASCII locales - #125
Merged
Conversation
Closes #73. The CLI rendered Unicode status glyphs unconditionally, so verify and list crashed with UnicodeEncodeError on any console whose encoding cannot represent them -- LC_ALL=C, or a Windows code page. Status symbols now fall back to one-column ASCII stand-ins (+ pass, x fail, > current, - locked) when the stream cannot encode them, and keep the Unicode glyphs when it can. The issue recorded verify and list, but solution and run crash on a separate path: they write the check file's captured output, and every check ends with print("<name> ✓"). That glyph comes from the curriculum rather than from our own formatting, so degrading the CLI's symbols alone would not have fixed it. All captured subprocess output now goes through a writer that replaces characters the encoding cannot represent rather than raising. This surfaced as a win-64 failure while packaging for conda-forge, where the test console is a pipe using cp1252. Integration coverage pins PYTHONIOENCODING explicitly so the regression is deterministic rather than dependent on the locale the suite runs under, and covers both the ASCII fallback and the UTF-8 path.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
abhiksark
added a commit
to xjcway123/pythonlings
that referenced
this pull request
Aug 21, 2026
Brings in the Windows and macOS CI matrix (abhiksark#126) so this TUI change is exercised on Windows before merge, plus the ASCII-locale CLI fix (abhiksark#125).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #73.
verifyandlistcrashed withUnicodeEncodeErroron any console whose encoding cannot represent their status glyphs. Status symbols now fall back to one-column ASCII stand-ins when the stream cannot encode them, and keep the Unicode glyphs when it can:+x>-The issue's recorded scope was narrower than the bug. It names
verifyandlist, butsolutionandruncrash on a different path — they write the check file's captured output, and all 292 checks end withprint("<name> ✓"). That glyph comes from the curriculum, not from our formatting, so degrading the CLI's own symbols would not have fixed those commands. All captured subprocess output now goes through a writer that replaces unencodable characters instead of raising.Found while packaging for conda-forge: the win-64 test runs in a pipe using cp1252, and
pythonlings solution variables1died there.Verification
Both new integration tests fail against the unpatched
cli.pyand pass with it. They pinPYTHONIOENCODINGexplicitly so the regression is deterministic rather than locale-dependent, and cover the UTF-8 path as well as the fallback.Exit codes and command semantics are unchanged; the TUI is untouched.