NCURSES_NO_UTF8_ACS: ncurses zu Unicode-Rahmen zwingen
Die Diagnose auf dem betroffenen Terminal war eindeutig: Zeile A (echte
UTF-8-Rahmenzeichen) zeichnete Linien, Zeile B (VT100-Umschaltung ESC(0)
nicht. Locale war bereits C.UTF-8, dialog war installiert - und die
Oberflaeche sah trotzdem falsch aus.
Grund: ncurses benutzt die VT100-Umschaltung AUCH mit UTF-8-Locale,
solange das terminfo sie anbietet - bei TERM=xterm der Fall. Die
Locale-Korrektur allein reichte deshalb nicht, und der Wechsel von
whiptail zu dialog machte es sogar schlechter, weil whiptail (slang)
bei UTF-8-Locale von sich aus Unicode zeichnet, ncurses aber nicht.
Abhilfe ist NCURSES_NO_UTF8_ACS=1. Mit dialog unter LANG=C.UTF-8 und
TERM=xterm gemessen:
ohne Schalter : 38 ESC(0, 0 Rahmenbytes, 182 rohe q
mit Schalter : 0 ESC(0, 220 Rahmenbytes, 0 rohe q
ui_init setzt den Schalter jetzt, sobald eine UTF-8-Locale gilt.
CMK_TUI_ACS=1 stellt das alte Verhalten wieder her - fuer Terminals, die
ESC(0 beherrschen, aber kein UTF-8.
tui-check zeigt den Stand des Schalters an und erklaert bei "A Linien,
B Buchstaben" jetzt, dass genau dieser Fall abgefangen wird und die
Oberflaeche trotzdem sauber aussehen muss.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+19
-2
@@ -1799,11 +1799,28 @@ instead.
|
||||
Measured: with `LC_ALL=C`, `whiptail` emits one `ESC(0` switch and **91 raw
|
||||
`q`** characters; with a UTF-8 locale, none at all.
|
||||
|
||||
**The script fixes this itself.** When starting the interface it sets
|
||||
**The script fixes this in two ways.**
|
||||
|
||||
**1. UTF-8 locale.** When starting the interface it sets
|
||||
`LC_CTYPE` to the first available UTF-8 locale (`C.UTF-8`, `en_US.UTF-8`, …) –
|
||||
only `LC_CTYPE`, so sorting and number formats stay untouched. If `LC_ALL` is
|
||||
set to a non-UTF-8 value it is removed, since it would otherwise override
|
||||
`LC_CTYPE`. Verify with:
|
||||
`LC_CTYPE`. **2. Unicode instead of VT100.** That alone is not enough: **ncurses uses the
|
||||
VT100 switch even with a UTF-8 locale** as long as the terminfo offers it –
|
||||
which it does for `TERM=xterm`. So `NCURSES_NO_UTF8_ACS=1` is set as well,
|
||||
making ncurses draw real Unicode box-drawing characters. Measured with
|
||||
`dialog` under `LANG=C.UTF-8` and `TERM=xterm`:
|
||||
|
||||
| | `ESC(0` | UTF-8 box bytes | raw `q` |
|
||||
|---|---|---|---|
|
||||
| without the switch | 38 | 0 | **182** |
|
||||
| **with the switch** | **0** | **220** | **0** |
|
||||
|
||||
`whiptail` does not need this – with a UTF-8 locale it draws Unicode by itself.
|
||||
For the opposite case – a terminal that handles `ESC(0` but not UTF-8 –
|
||||
`CMK_TUI_ACS=1` restores the old behaviour.
|
||||
|
||||
Verify with:
|
||||
|
||||
```bash
|
||||
./scripts/cmk-manage.sh selftest # section "Zeichensatz fuer die Oberflaeche"
|
||||
|
||||
Reference in New Issue
Block a user