Repository navigation
Preserve Unicode output with the Windows more pager - #1865
Conversation
Assisted-by: OpenAI Codex
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1865 +/- ##
=======================================
Coverage 99.76% 99.76%
=======================================
Files 23 23
Lines 6777 6785 +8
=======================================
+ Hits 6761 6769 +8
Misses 16 16
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
|
Thanks, @euno102, for tracking this down and fixing it. Your reproduction showed why checking the exit code alone would miss the problem: We added a follow-up in 1cc2bdb for interactive output streams that use a strict encoding such as CP1252. Bypassing We also linked the PR to close #1845 on merge. Thanks again for the contribution! |
Summary
Closes #1845. Windows
more.comcan exit with status 0 after dropping a line of UTF-8 text. I reproduced this by piping a long CJK line intomore.comwith console code page 65001. The trailing marker was missing, while the same probe with ASCII retained it.When
ppaged()would use Windowsmoreormore.comfor non-ASCII output, it now writes the rendered text directly. If the output stream rejects a character, cmd2 displays its Unicode escape and preserves the surrounding text. This trades pagination for preserving the text in that case. ASCII output and configured alternative pagers still use the existing pager path. The scope is the external pager path, separate from the toolbar pager in #1814.Validation
make check,make test(3,218 passed, 7 skipped), andmake docs-testpassed.AI disclosure: OpenAI Codex helped reproduce the issue, write the patch and regression tests, run validation, and draft this description.