I have a server with a samba share on zfs filesystem. Filenames are in hungarian. When I login with ssh, then the file names are diplayed incorrectly in the terminal:

enter image description here

If I do an auto complete on the filename, then it is clear that the filename itself is good, containing non-ascii characters:

enter image description here

I have already tried to set terminal type string to "putty", change terminal character set to UTF-8 or ISO-8859-2 but none of them helped.

The same problem appears in midnight commander, even the "lines" are incorrect:

enter image description here

It I change the display chars in putty config to ISO8859-2:

enter image description here

Then at least the line chars are correct, but the filenames are still bad:

enter image description here

If I start "mc -ac" then I see dashes instead of lines, but the filenames are still wrong:

enter image description here

So must be a problem with the locale. If I do this:

setenv LANG hu_HU.ISO8859-2

then it is still wrong:

enter image description here

It I set putty config to UTF-8 and LANG to hu_HU.UTF-8 then it SOME characters are good, but not all of them:

enter image description here

I'm lost. I have tried many other combinations, but none of them seems to work correctly. Does anybody know how to setup this, so that filenames and graphical chars are shown correctly in both the shell and mc?

By the way, the correct filename prefix should be: "Díjbekérő"


Here is the correct solution.

Set the LANG enviroment variable to hu_HU.UTF-8


setenv LANG hu_HU.UTF-8 


export LANG

Also set the "terminal encoding" in putty to UTF-8:

enter image description here

Then it is perfect, both in the shell and in mc:

enter image description here enter image description here

This also solved the problem when I login from a linux box with xterm/gnome-terminal whatever.

It seems that the general "system wide" solution is to create a new class in /etc/login.conf with these:


Then run cap_mkdb /etc/login.conf and finally change specific users' login classes with chsh. (For new users, it is the best to specify the login class when "adduser" asks for it.)

It was all documented here, except for the terminal encoding:


and probably I could have figured this out before sending in a question. But I'm providing the answer anyway, in case somebody runs into the same problem.

UPDATE: after you do this, you won't be able to use WinSCP with the default settings. WinSCP will try to execute "ls -la" on the server and parse the result. For non-english locale, the result will contain dates in a different language, and WinSCP cannot interpret that. To overcome this problem go to configuration and change the listing command from "ls -la" to "env LANG=en_US.UTF-8 ls -la". (It is under Edit connection / Advanced / Environment / SCP/Shell / Directory Listing )

By using this setting, you will be able to use WinSCP and keep the default locale of the user at the same time.

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.