]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.15] gh-133031: Support non-ASCII characters in curses.textpad.Textbox (GH-152451...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 29 Jun 2026 11:40:49 +0000 (13:40 +0200)
committerGitHub <noreply@github.com>
Mon, 29 Jun 2026 11:40:49 +0000 (14:40 +0300)
commitbbc7e9b32321c52159462ab5be0048bbe82312d6
treea5c4076eda5230a47839a1538f43927c2320a62d
parent1507ea1e8f0a0a2038d272dc57a6b03a0691c880
[3.15] gh-133031: Support non-ASCII characters in curses.textpad.Textbox (GH-152451) (GH-152467)

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>
Lib/curses/textpad.py
Lib/test/test_curses.py
Misc/NEWS.d/next/Library/2026-06-27-12-30-00.gh-issue-133031.Na8Bit.rst [new file with mode: 0644]