Skip to main content

SS2/SS3

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

SS2 (Single-Shift Two) and SS3 (Single-Shift Three) are C1 control functions that temporarily invoke the G2 or G3 character set for the next graphic character only.

Syntax​

ESC N         SS2 — Single-shift G2 (7-bit)
0x8E SS2 — Single-shift G2 (8-bit C1)
ESC O SS3 — Single-shift G3 (7-bit)
0x8F SS3 — Single-shift G3 (8-bit C1)
Formal syntax
SS2 = ( 0x1b, "N" ) | 0x8e ;
SS3 = ( 0x1b, "O" ) | 0x8f ;

Description​

Per ECMA-48 §8.3.141 and §8.3.142, SS2 and SS3 are used for code extension purposes, causing the meanings of the bit combinations following them to be changed. Their detailed use is defined in ECMA-35.

Unlike the locking shifts (SO/SI, LS2, LS3), which change the active character set until explicitly changed back, single shifts affect only the very next graphic character:

  • SS2 temporarily invokes G2 into GL for the next character, then GL reverts to its previous state.
  • SS3 temporarily invokes G3 into GL for the next character, then GL reverts to its previous state.

SS3 and function keys​

In practice, SS3 is most commonly encountered as part of function key escape sequences in application mode. For example, when the cursor keys are in application mode (DECCKM set), the arrow keys send SS3 A, SS3 B, SS3 C, SS3 D — which in 7-bit form are ESC O A, ESC O B, etc.

The keypad in application mode (DECKPAM) also sends SS3-prefixed sequences: ESC O p through ESC O y for digits 0-9.

note

Because ESC O is the 7-bit encoding of SS3, there can be ambiguity when a terminal receives ESC O — it could be the start of a function key sequence or an actual SS3 character set shift. In practice, modern terminals always interpret it in the function key context.

Specifications​

SpecificationSection
ECMA-48§8.3.141, §8.3.142

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✗NoNo SS2/SS3 single shift support found; not in escape_support.md
Bobcat✓0.9.0Single shift sequences, handled in TerminalCtrl library
contour✓v0.1.0ESC N (SS2) and ESC O (SS3) implemented; single shift G2/G3 charsets
foot✓YesImplemented in vt.c:517-525 as ESC N/O
Ghostty✓v1.0.0ESC N and ESC O handled in stream.zig:2215-2239, single shift G2/G3
iTerm2✗NoExplicitly marked as VT100_NOTSUPPORT
Kitty✗No
Konsole✗NoNo handlers for ESC N/O sequences
mintty✓YesSS2 at src/termout.c:2049-2050, SS3 at src/termout.c:2051-2052
mlterm✓rel-0_2_1Delegated to mef library for ISO-2022 encodings
PuTTY✗NoESC N and ESC O not implemented in escape sequence handler
Rio✗NoNo ESC N or ESC O handling found
rxvt-unicode✗NoExplicitly commented out in code
st✗NoMarked TODO in st.c:2272-2273
terminology✗NoCommented out, not implemented
VT100✗No
VTE✓Yes
WezTerm✓YesDefined in esc.rs:42-43 as EscCode::SingleShiftG2/G3 (ESC N/O)
Windows Terminal✓YesESC N dispatches SingleShift(2), ESC O dispatches SingleShift(3) in OutputStateMachineEngine.cpp:235-239
xterm✓YesImplemented in charproc.c:5474-5486. Requires vtXX_level > 1 (VT220+)
xterm.js✗NoSS2/SS3 used in keyboard output encoding but not handled as input
Multiplexers
cy✗NoESC N/O not in EscDispatch
GNU Screen✓v.4.2.0SS2 (ESC N) and SS3 (ESC O) implemented in DoESC() at src/ansi.c:776-788
tmux✗NoESC N and ESC O not in escape table
tuios✓v0.0.15
Zellij✗No

See also​