Skip to content

Copying — or é through pbcopy lands intact without a UTF-8 locale - #353

Merged
jamescrosswell merged 1 commit into
mainfrom
milestone-347-clipboard-utf8
Sep 30, 2026
Merged

jamescrosswell merged 1 commit into
mainfrom
milestone-347-clipboard-utf8

Conversation

@a-team-app

@a-team-app a-team-app Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

A copy that falls back to pbcopy now lands —, §, é and emoji intact even when TuiCode was started without a UTF-8 locale (launchd, some SSH/tmux setups), instead of pasting as ‚Äî while the status bar said Copied ….

Closes #347

  • pbcopy/pbpaste get LC_ALL=en_US.UTF-8. LC_CTYPE alone isn't enough: an inherited LC_ALL=C overrides it and the text still garbles. Everything else in the environment is passed through.
  • wl-copy/xclip: left alone. Both pass the bytes through untouched (text/plain;charset=utf-8 / UTF8_STRING) without converting by locale. That's from how they work; I haven't run them on Linux. clip.exe already gets UTF-16 with a BOM.

a-team try tuicode 353

Without LANG/LC_ALL/LC_CTYPE, pbcopy stores the bytes as Mac Roman
(— becomes ‚Äî) and pbpaste encodes them back, so the read-back matched
and TuiCode reported Copied while the clipboard held garbled text.
LC_ALL rather than LC_CTYPE, since an inherited LC_ALL=C overrides
LC_CTYPE. Only the variable is overridden; the rest of the environment
still reaches the programs.

wl-copy and xclip pass the bytes through untouched (UTF8_STRING /
text/plain;charset=utf-8, no locale conversion), and clip.exe is already
handed UTF-16 with a BOM, so they're unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@a-team-app
a-team-app Bot marked this pull request as ready for review September 29, 2026 12:15
@jamescrosswell
jamescrosswell merged commit c13a477 into main Sep 30, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copying text like — or é through the system's clipboard program can land garbled while saying it copied

1 participant