Skip to main content
ansicode

DECRQUPSS / DECAUPSS — Request / Assign User-Preferred Supplemental Set

Query (CSI & u) and assign (DCS Ps ! u … ST) the supplemental character set the terminal maps into the GR slot when no Locking Shift is active. Closes the supplemental-set plumbing left after single-locking-shift.

Byte forms

Every common string-literal form so you can paste-and-search either direction.

\\x1b[\x1b[&u request \x1bP<Ps>!u<D…D>\x1b\\ assign
\\033[\033[&u request \033P<Ps>!u<D…D>\033\\ assign
\\e[\e[&u request \eP<Ps>!u<D…D>\e\\ assign
ESC [ESC [ & u / ESC P <Ps> ! u <D…D> ESC \\
hex1b 5b 26 75 / 1b 50 <Ps> 21 75 <body> 1b 5c

Description

DECRQUPSS (*Request User-Preferred Supplemental Set*, \x1b[&u) and its setter DECAUPSS (*Assign User-Preferred Supplemental Set*, \x1bP<Ps>!u<body>\x1b\\) cover the half of ISO 2022 character-set switching that single-locking-shift deliberately punted on: who is the GR (right-half, 0xA0–0xFF) charset by default, before any Locking Shift fires.

Why this matters. On a 7-bit channel (Telnet, serial cards, NRCS terminals) the GR half is the only place left for non-ASCII glyphs once the GL half holds ASCII. ISO 2022 calls the resident occupant of GR the *user-preferred supplemental set* — by DEC default it is DEC Supplemental Graphic (the historical accent / box-drawing / math set), but ECMA-43 / DEC VT510 allow assigning ISO Latin-1 (or any registered 96-char set) into the slot instead. DECAUPSS lets the host say 'from now on, GR is Latin-1'; DECRQUPSS lets the host ask 'what does GR resolve to right now?'.

Request shape — DECRQUPSS: \x1b[&u. No parameters; the & intermediate + u final is the only form.

Reply shape — terminal echoes its current UPSS via DECAUPSS-shaped frame: \x1bP<Ps>!u<DesignatorBytes>\x1b\\. Ps = 0 for a 94-character set (G0-style designator), Ps = 1 for a 96-character set (Latin-style designator). <DesignatorBytes> is the ISO-2022 final-byte that names the set: - %5 → DEC Supplemental Graphic (the DEC default, returns \x1bP0!u%5\x1b\\) - A → ISO Latin-1 Supplemental (\x1bP1!uA\x1b\\ — 96-set, so Ps=1) - < → DEC Technical Set - = → DEC Hebrew Supplemental, "4 → DEC Hebrew-7, "? → DEC Greek, %2 → Turkish, R → French, K → German (the NRCS family)

Set side — DECAUPSS uses the identical body. To put Latin-1 into GR: \x1bP1!uA\x1b\\. To restore DEC default: \x1bP0!u%5\x1b\\. Effect is global until next DECAUPSS, DECSTR soft reset (which restores DEC default), or RIS hard reset.

Relationship to the shift family. Designators (\x1b ( / ) / * / +) load specific sets into the G0/G1/G2/G3 registers. Locking Shifts (LS0 / LS1 / LS1R / …) and Single Shifts (SS2 / SS3) *invoke* those registers into GL / GR. UPSS is the fallback — when no Locking Shift to GR is active, GR resolves to the UPSS, not to G1. This explains why \x1b(0 (DEC Special Graphics → G0) + a GL byte produces line-drawing characters but a *high-bit* byte (0xA0+) without LS1R still hits whatever UPSS is set to (DEC Supplemental by default, Latin-1 if reassigned).

Coverage — niche. Real xterm + mlterm + gnome-terminal + Konsole = full (the ISO 2022 path is still alive there because terminfo's acsc/smacs/rmacs route through it). WezTerm + iTerm2 = partial (parse + acknowledge the request but treat the body as no-op; their default is Latin-1 because UTF-8 already covers what UPSS was for). Kitty / Alacritty / Ghostty / Windows Terminal / cmd / ConPTY / macOS Terminal / Linux console = no-op (silently ignore both directions — UTF-8 obsoleted the use case). In 2026, send DECAUPSS only if the receiver is a known ISO-2022-aware emulator; otherwise use UTF-8 encoded text directly.

Spec citation: DEC VT510 RM (DECRQUPSS / DECAUPSS) / ISO 2022 §6.4 (UPSS) / ECMA-35 §13.4

Parameters

Ps = 0 (94-set)designator is a 94-character set (most DEC sets — DEC Supplemental %5, DEC Technical <, NRCS R/K/=)
Ps = 1 (96-set)designator is a 96-character set (Latin-1 A, Latin-2 B, Latin-Cyrillic L, Latin-Greek F, Latin-Hebrew H)
%5DEC Supplemental Graphic (DEC default for UPSS)
AISO Latin-1 Supplemental (the modern default when leaving DEC mode)
<DEC Technical Character Set (math / Greek glyphs for technical typesetting)

Examples

bash
# Probe UPSS, parse the DCS reply (timeout-protected).\nprintf '\\033[&u'\nIFS= read -rs -d '\\\\' -t 0.1 reply </dev/tty 2>/dev/null\necho \"UPSS reply: ${reply}\"   # xterm: \\x1bP1!uA\\x1b  (Latin-1 today on most builds)\n# Re-assign UPSS to DEC Supplemental Graphic (DEC default):\nprintf '\\033P0!u%%5\\033\\\\'
python
import sys, re, tty, termios, select\n# Switch GR to ISO Latin-1, then back to DEC Supplemental.\nsys.stdout.write('\\x1bP1!uA\\x1b\\\\')   # GR = Latin-1\nsys.stdout.flush()\n# ... do work that emits 0xA0–0xFF bytes ...\nsys.stdout.write('\\x1bP0!u%5\\x1b\\\\')  # restore DEC default\nsys.stdout.flush()
go
// Parse a DECRQUPSS reply: extract Ps + designator.\nimport (\n    \"fmt\"\n    \"regexp\"\n)\nvar upssRe = regexp.MustCompile(\"\\x1bP([01])!u([^\\x1b]+)\\x1b\\\\\\\\\")\nfunc parseUPSS(buf string) (ps int, designator string, ok bool) {\n    m := upssRe.FindStringSubmatch(buf)\n    if m == nil { return 0, \"\", false }\n    fmt.Sscanf(m[1], \"%d\", &ps)\n    return ps, m[2], true\n}
javascript
// Reassign UPSS to Latin-1 (modern default) and confirm.\nprocess.stdout.write('\\x1bP1!uA\\x1b\\\\');\n// Query: emit DECRQUPSS and parse the reply.\nprocess.stdout.write('\\x1b[&u');\nprocess.stdin.once('data', (buf) => {\n  const m = /\\x1bP([01])!u([^\\x1b]+)\\x1b\\\\/.exec(buf.toString('binary'));\n  console.error('UPSS Ps=' + (m?.[1] ?? '?') + ' set=' + (m?.[2] ?? '?'));\n});
c
/* Set UPSS to Latin-1, then probe. */\nfputs(\"\\x1bP1!uA\\x1b\\\\\", stdout);\nfputs(\"\\x1b[&u\", stdout); fflush(stdout);\n/* Read until ST (0x1b 0x5c) with 100ms select timeout, then parse !u<designator>. */

Terminal support

xterm
yes
Linux console (fbcon)
no
macOS Terminal.app
no
iTerm2
partial
Windows Terminal
no
cmd.exe / ConPTY
no
kitty
no
alacritty
no
WezTerm
partial
Ghostty
no
GNOME Terminal
yes
Konsole
yes
tmux
yes
GNU screen
yes

Related sequences

In the family cookbook

DCS cookbook · 3. Asking the terminal questions — DECRQSS, terminfo cap, DECRQTSR, DECRQUPSS, cursor-style