mirror of
https://github.com/python/cpython.git
synced 2026-11-09 06:00:54 +08:00
Textbox mangled non-ASCII characters of an 8-bit locale encoding: it masked reads with curses.ascii.ascii(), which clears the 8th bit, and tested input with curses.ascii.isprint(), which rejects bytes above 127. Decode cells and input bytes with the window's encoding instead. Cells are read with instr() and the lower-right cell is written as text, since inch() and insch() with an int byte mishandle a non-ASCII character on a wide build. This uses only the byte-oriented curses API, so it works without wide-character support. (cherry picked from commit c253f0c14b046cf79881d0602620a3b2a15c2316) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>