#1145436 UTF-8 corruption/alignment issues in caption rendering

Package:
screen
Source:
screen
Description:
terminal multiplexer with VT100/ANSI terminal emulation
Submitter:
Peter Dey
Date:
2026-08-25 08:13:01 UTC
Severity:
normal
Tags:
#1145436#5
Date:
2026-08-25 07:00:24 UTC
From:
To:
Fixing #215955 (UTF-8 caption corruption) revealed other UTF-8-related
issues.

1. Hardstatus/caption width accounting uses byte-length instead of
cell-width
    This causes alignment/padding issues with non-ASCII captions.

2. OSC forwarding path re-encodes caption payload bytes in a way that
can
    corrupt data that is already UTF-8.

3. After hardstatus redraw, cursor restore can be wrong in some
scenarios where
    the caption includes UTF-8 chars, leading to prompt/cursor placement
    anomalies until a redraw.

Minimal hardstatus to reproduce:

   hardstatus alwayslastline "%=%t | %c "

A non-ASCII caption (e.g. Latin-extended or emojis) triggers incorrect
layout/cursor behaviour.

Tests:
   printf '\e]0;%s\e\\' "abc ó ą ⭍ 💩"
   printf '\e]0;%s\e\\' "Fußgängerübergänge"