Repository navigation
Start the tmux server with a UTF-8 locale - #65
Merged
ryanclouser merged 1 commit intoOct 6, 2026
Merged
Conversation
ensure_tmux_server spawned `tmux start-server` with muxel's GUI environment, which on macOS carries no LANG/LC_*. Every program in a session is a child of that server, so agents ran with no locale and anything locale-dependent fell back to ASCII. The visible symptom: text copied through pbcopy decodes as Mac Roman, turning "aprobación" into "aprobaci√≥n". Default LANG on the server command the same way ensure_utf8_locale already does for pane clients: only when no locale is declared at all. Fixes ProjectHax#64 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Hi there, before merging please consider if this is the best solution, the issue is totally true, as a spanish speaker I was having the problem described in the PR. |
Contributor
|
Thanks, merged! And glad you're enjoying muxel. On whether this is the best fix: I think so. Programs in a session inherit the tmux server's environment, not the client's, so the server is the right place for the fallback. The alternatives were worse: |
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.
Fixes #64
Problem
On macOS, text copied from an agent running in a tmux-backed pane loses every non-ASCII character to mojibake:
aprobación→aprobaci√≥n,▎→‚ñé. Agents copy throughpbcopy, andpbcopydecodes its input as Mac Roman when the process has no locale.The process has no locale because of how the shared tmux server is started.
ensure_tmux_server()runs it with a plainCommand, so it inherits muxel's GUI environment, where launchd sets noLANG/LC_*. Every program in a session is a child of that server. TheLANGfallback thatensure_utf8_localeadds only reaches each pane's tmux client, and tmux doesn't forwardLANGto new sessions because it is not in the defaultupdate-environment.Fix
Give the
tmux start-servercommand the same fallback the PTY path already uses:needs_utf8_locale→LANG=FALLBACK_UTF8_LOCALE. Likeensure_utf8_locale, it only fills a gap. A locale the user has actually set is never touched.One file changed (
crates/muxel/src/integrations.rs).Verification
cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warningsandcargo test --workspaceall pass.I ran a throwaway test, not included here, that clears
LANG/LC_ALL/LC_CTYPEand calls the realensure_tmux_server()on an isolatedTMUX_TMPDIR. It then opens a session the way a pane does (tmux -u new-session, withLANGset on the client) and records what the program inside sees:master(006b8b2)LANG=(nothing)LANG=en_US.UTF-8pbcopyon its own, outside muxel, reproduces the reporter's exact output without a locale and correct text with one (see macOS: tmux server starts without a locale, so non-ASCII text copied from agent panes is mojibake (á → √°) #64).Note for existing users
The tmux server outlives muxel, so anyone who already has a server running keeps its empty environment until that server restarts (
tmux kill-server, or a reboot). New servers get the locale from the start.🤖 Generated with Claude Code