DECNRCM National Replacement Character Set Mode
Allow the 7-bit national character sets, which replace a few ASCII characters with letters of one language.
CSI ? 42 h
- Defaults
- reset
- DEC STD 070
- §5.8.2 Set/Reset Character Set Mode, p. 5-126
- VT510
- DECNRCM—National Replacement Character Set Mode
Before 8-bit character sets, each country had a 7-bit national replacement character set: ASCII with a dozen of its characters, such as [, \ and ], replaced by letters the language needs. German, for instance, has Ä, Ö and Ü in their places. Mode 42 chooses between those and the 8-bit multinational sets. Reset, the default, the terminal uses the multinational sets; set (CSI ? 42 h), a national set can be designated with SCS, the same way any other set is.
In xterm, the national sets that need the mode are refused while it is reset. Its table of designations marks each one (charproc.c), German ESC ( K among them, and designation skips any such set unless the mode is set (xtermDecodeSCS). The United Kingdom set, ESC ( A, which replaces # with £, came with the VT100 and needs no mode. With the mode set, German maps [, \, ], {, |, } and ~ to Ä, Ö, Ü, ä, ö, ü and ß (charsets.h). The mode itself is set and reported at level 2 and up (charproc.c, do_dec_rqm). In UTF-8 mode, xterm also switches its UTF-8 decoding while the mode is set (modified_DECNRCM).
DEC STD 070 adds that changing the mode puts every designated and invoked character set back to its default, and that the national set used comes from the keyboard dialect chosen in Set-Up. xterm does not reset the sets when the mode changes, and the cases follow xterm.
libghostty-vt does not have the mode: mode 42 is not in its table in modes.zig, so DECRQM reports it as not recognized (0). It also has no national sets at all: charsets.zig knows only UTF-8, ASCII, the United Kingdom set and DEC Special Graphics. Three cases are known differences.
Validation
DECNRCM-1: Reset by default
\e[?42$p
|_____|
reply \e[?42;2$y
DECNRCM-2: Set
\e[?42h
\e[?42$p
|_____|
reply \e[?42;1$y
DECNRCM-3: German is refused while the mode is reset
\e(K # German into G0
[\\]
|[\]__|
DECNRCM-4: And used once it is set
\e[?42h
\e(K # German into G0
[\\]{|}~
|ÄÖÜäöüß_|
DECNRCM-5: The United Kingdom set needs no mode
\e(A # United Kingdom into G0
\#
|£____|