I started playing around with Curses and noticed that the textbox does not accept German umlauts. Even after following the internet’s hint to set locale the input does not work even though the characters get displayed properly when printed via code.
I tested on Ubuntu20.04 via PuTTY with Python3.10.12 and was surprised that I can even display Japanese characters. But printing a rectangle did not work properly.
So, I switched to the Windows10 cmd with Python3.11.1. Here the rectangle is displayed properly, but the Japanese characters are not displayed anymore and the input is still not working. (I tried chcp 65001 which did not work. For Japanese characters I have to rely on chcp 932 which works fine, except for the big 'ẞ'.)
This is the code around the textbox:
import curses
from curses.textpad import Textbox, rectangle
import locale
locale.setlocale(locale.LC_ALL, "")
def main(stdscr):
stdscr.addstr(3, 12, "äÄ öÖ üÜ ßẞ µ ²³ ° <|> € ´`")
stdscr.addstr(4, 12, "これはテストです。漢字も。")
win = curses.newwin(5, 30, 6, 12)
rectangle(stdscr, 5, 11, 11, 42)
box = Textbox(win)
stdscr.refresh()
box.edit()
text = box.gather().strip().replace("\n", "")
stdscr.addstr(12, 12, text)
stdscr.getch()
curses.wrapper(main)
Main question: How do I enable textbox to accept more characters?
Also interesting: How do I get the Ubuntu version to display proper borders?