OSC 0 Set Icon Name and Window Title
Set the window's title and its icon name to the same text.
OSC 0 ; Pt ST
OSC 0 ; Pt ST sets both the window’s title and its icon name, the name a window manager shows for it when it is iconified, to Pt. It is the one shells use most, since in a desktop with no icons the two come to the same thing. OSC 1 sets only the icon name, and OSC 2 only the title. The three came from dtterm, and xterm has had them since its beginnings.
Characters beyond Latin-1. A default xterm reads its input as UTF-8 and collects the text of an OSC one character at a time. For OSC 0 and OSC 2 it keeps characters up to U+00FF as they are, and turns every character above that into ? (doparsing, and the title text), so café survives and an emoji or a CJK character does not. Its title modes, set with CSI > Ps t, let a program send the title in hexadecimal instead. libghostty-vt keeps the title as the UTF-8 it was sent, every character of it, which the case for that is a known difference.
As with OSC 2, xterm takes an empty OSC 0 as the title xterm.
libghostty-vt has no icon name: it keeps the title, which its host reads through the TITLE_CHANGED callback.
Validation
OSC0-1: Sets the title
\e]0;Shell\a
|___|
title "Shell"
OSC0-2: Latin-1 is kept
\e]0;café\a
|___|
title "café"
OSC0-3: Beyond Latin-1, xterm writes ?
\e]0;café ☕\a
|___|
title "café ?"
OSC0-4: Nothing on screen
A
\e]0;Shell\e\\
B
|AB_|
cursor 1,3