Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am logged into a Mac, running Terminal, ssh'ed into a Linux system and running make in an emacs window. My error log looks like this:

_raw.cpp:139: error: invalid conversion from âconst char*â to âsize_tâ
_raw.cpp:139: error:   initializing argument 2 of âint snprintf(char*, size_t, const char*, ...)â
_raw.cpp:139: error: invalid conversion from âintâ to âconst char*â
_raw.cpp:139: error:   initializing argument 3 of âint snprintf(char*, size_t, const char*, ...)â

Notice that apparently GCC is trying to use the unicode smartquote characters, but they are being sent as UTF-8 and Emacs is intercepting them. I think that the problem here is that EMACS needs to pass the UTF-8 generated by the subprocess through to the Terminal. Any idea how to make that happen?

share|improve this question
up vote 2 down vote accepted

The remote host doesn’t know that your terminal is using UTF-8.

By default, Terminal encodes text as UTF-8, and by default Terminal communicates this to the terminal shell via the LANG environment variable (as long as you haven’t changed these preference settings).

You can see the encoding (and language) being used with the command locale. For example, this is what it says on my Mac:

$ locale

If you run it locally and on the remote host you should see that the remote host doesn’t include “utf-8” in the locale values.

However, prior to Mac OS X Lion 10.7, by default ssh doesn’t communicate the LANG environment variable to the remote host. You can arrange for this, but it requires configuring both the ssh client on your Mac to send the LANG variable and the sshd daemon on the remote host to read it.

See the ssh_config and sshd_config man pages on the Mac and the remote host for details. You will probably add a line like SendEnv LANG LC_* to the /etc/ssh/ssh_config file on your Mac and AcceptEnv LANG LC_* in /etc/ssh/sshd_config on the remote host (the details may vary on the remote host).

Alternatively, you can simply export LANG="en_US.UTF-8" once you log in to the remote shell (the exact syntax depends on the remote shell you’re using). Be sure to use the correct language if it isn’t US English (“en_US”). You may also automate this by setting LANG from within a shell startup script like ~/.bash_profile on the remote host.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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