How to make the login shell xterm use utf-8?

At the time the sshd process on the remote computer forks to run /usr/bin/xterm there are very few environment variable set. In fact the LANG variable is not set. Hence the xterm process does not know that it should display characters in UTF-8. It falls back to xterms defaults. Whatever that might be.

However, the subshell running inside the xterm runs all setup scripts and alike. Including setting the LANG environment variable.

One needs to understand the difference between the remote xterm process and the shell process running inside of xterm.

The solution is to run the remote xterm process like this:

/usr/bin/env LANG=en_US.UTF-8 /usr/bin/xterm

env(1) is a utility to run a program in a modified environment.

Setting LANG will make the remote xterm display UTF-8 characters properly.

Eskil... :-)

P.s: Reading the xterm manual page I also found an easier way to achieve this:

xterm -en en_US.UTF-8

P.P.s: I do not think setting resources in ~/.Xresources will take effect unless you merge them in with xrdb. The xterm process on the Linux computer will query the X server running on your windows computer. At the time where xterm starts it is very unlikely that your X-Win32 server has the xterm* resources set. But you might be able to set resources in X-Win32 if it supports that.


I think you're not telling xterm to use a Unicode font. I see that you're using some xterm-compiled-for-Windows or something, but under Arch (and other distros) when running a real xterm, I start it like this:

xterm -u8 -fn '-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso10646-1'

Another Windows terminal emulator, PuTTY, seems pretty good at showing UTF-8. If you are allowed, you should put PuTTY, set it to use a UTF-8 character set, and connect to the Red Hat server. If PuTTY correctly renders multi-byte UTF-8 characters, you know the problem is not on the server side, but rather in the terminal emulator.

Tags:

Unicode

Xterm