Copying — or é through pbcopy lands intact without a UTF-8 locale - #353
Merged
Merged
Conversation
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>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A copy that falls back to
pbcopynow 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 saidCopied ….Closes #347
pbcopy/pbpastegetLC_ALL=en_US.UTF-8.LC_CTYPEalone isn't enough: an inheritedLC_ALL=Coverrides 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.exealready gets UTF-16 with a BOM.a-team try tuicode 353