I think an easy conclusion to reach from your descriptions, is that
LANG is being set properly by your login shell, but is not provided
when your commands are directly run by ssh - /etc/locale.conf is
probably read by your ~/.bashrc (or equivalent) or ~/.profile
(directly or indirectly), neither of which are run for non-interactive
shells of this sort. If you change RemoteCommand to "env" or "echo
${LANG:-nolangvalue}" you might see evidence of this.As Nicholas suggested, -u needs to be added to the attach as well, to take effect; or you could probably prepend a ". /etc/locale.conf; " to your RemoteCommand. (Detection of unicode support is necessarily based on the environment of the attaching terminal, and not an overall setting in the tmux session, which is why you need the -u in attach. It's fine that your system supports unicode - but if you attach to it with a unicode-unsupporting terminal, then of course you wouldn't want it to use unicode there) -mjc On Wed, Jan 16, 2019 at 11:57 AM Frederick Zhang <[email protected]> wrote: > > Hi guys, > > I know this may not be the best place to post this issue but I've been > experiencing a really weird problem with tmux under ArchLinux and so far I've > got absolutely no clue after plenty of research. So hope you guys can shed > some light on me. > > To create new/attach to existing tmux sessions automatically, I've got the > following configurations in my ssh_config: > > Match originalhost MyHost exec "[[ $(ps h o args p $PPID | wc -w) -eq 2 ]]" > RemoteCommand tmux has-session && tmux attach || tmux -u > RequestTTY yes > Host MyHost > PreferredAuthentications publickey,password > > This works perfectly for my Debian/Ubuntu servers, but when I try to connect > to my Raspberry Pi, which runs ArchLinuxARM: > > If there's no tmux running, ssh MyHost starts a new session and everything > looks good > If there's already a tmux session, ssh MyHost attaches to the existing > session, but all special UTF-8 characters are shown as underscores, e.g. the > small box and arrows in my status bar, CJK characters > If I comment out the Match section in ssh_config and manually run tmux > has-session && tmux attach || tmux -u after connected, UTF-8 always works > > Both the packages in ArchLinux and Debian/Ubuntu are configured with only > --enable-utempter. The Arch one is 2.8 and the Debian one is 2.6 with one > Debian-specific patch. Trying to eliminate the differences, I built and > installed tmux 2.6 in my Pi but it didn't help. The symptom remained as it > was. > > I'm using exactly the same tmux configurations across all my servers, which > are from https://github.com/gpakosz/.tmux with a few minor customisations. > And yes, I'm using a UTF-8 locale: > > $ locale -a > C > en_AU.utf8 > en_GB.utf8 > en_US.utf8 > POSIX > $ cat /etc/locale.conf > LANG=en_US.UTF-8 > > I guess this is somehow related to TTY but after several hours of googling > and throwing it to forums, I still haven't got a single idea on how to > resolve it. So it'd be great if you guys can help me out. Thanks a ton! > > -- > Best Regards, > Frederick Zhang > > -- > You received this message because you are subscribed to the Google Groups > "tmux-users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "tmux-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
