Skip to content

Handle Unicode-unsafe terminals in CLI success output#53

Merged
srichs merged 1 commit intomainfrom
codex/fix-unicodeencodeerror-in-devr-check
Feb 17, 2026
Merged

Handle Unicode-unsafe terminals in CLI success output#53
srichs merged 1 commit intomainfrom
codex/fix-unicodeencodeerror-in-devr-check

Conversation

@srichs
Copy link
Owner

@srichs srichs commented Feb 17, 2026

Motivation

  • The CLI emitted emoji-only success messages which raised UnicodeEncodeError on terminals that can't encode emoji (e.g., Windows cp1252), causing devr check to crash after tests.

Description

  • Add a helper _echo_with_fallback(primary, fallback) in src/devr/cli.py that calls typer.echo(primary) and falls back to ASCII-safe text when a UnicodeEncodeError is raised.
  • Replace direct emoji success messages for check, fix, and security with _echo_with_fallback(...) using plain-text fallbacks.
  • Add a regression test test_echo_with_fallback_uses_plaintext_when_unicode_encoding_fails in tests/test_cli.py that simulates an encoding failure and asserts the fallback is used.

Testing

  • Ran the test suite with pytest -q, which passed: 92 passed in 0.79s.
  • The new unit test simulating typer.echo encoding failure also passed as part of the test run.

Codex Task

@srichs srichs merged commit 43c4079 into main Feb 17, 2026
7 of 8 checks passed
@srichs srichs deleted the codex/fix-unicodeencodeerror-in-devr-check branch February 17, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant