0

When I try to connect to a remote machine from an ansi-term terminal using mosh (a remote terminal application), I get the following:

$ mosh -- user@host.domain

mosh-server needs a UTF-8 native locale to run.

Unfortunately, the local environment (LC_CTYPE=) specifies
the character set "US-ASCII",

The client-supplied environment (LC_CTYPE=) specifies
the character set "US-ASCII".

LANG=
LC_CTYPE=
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
Connection to user@host.domain closed.
/usr/local/bin/mosh: Did not find mosh server startup message.

I don't have this problem from iTerm2.

2

iTerm2 and Terminal.app automatically set LANG and LC_* from the global language settings of OS X. For instance, if your OS X installation is configured for US language a shell in iTerm2 and Terminal.app automatically receives LANG=en_US.utf8 in its environment.

Emacs' ansi-term however does not do this. Hence you need to explicitly configure your language environment in the initialisation file of your shell. For Zsh for instance you would add the following to ~/.zshenv:

if [[ -z $LANG ]]; then export LANG=en_US.utf8; fi
  • Thanks! It worked, but this is interestingly making ansi-term much slower (e.g. scrolling and rendering of text) when I connect. I am using "GNU Emacs 24.5.1 (x86_64-apple-darwin14.1.0, NS apple-appkit-1344.72)" from brew on a modern MacBook. Not sure how much that matters. – Amelio Vazquez-Reina May 20 '15 at 12:34
  • Does it slow down for ASCII-only text as well, or just for non-ASCII text? – lunaryorn May 20 '15 at 12:38
  • Regular ASCI-text (e.g. ls a directory with an only-ASCII prompt and contents with ASCII-only characters ) – Amelio Vazquez-Reina May 20 '15 at 13:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.