working with filenames in a different encoding over ssh
Inside a terminal emulator that supports UTF-8, you can use the luit
command to run a subshell (or other program) in a different locale. The locale setting that indicates character sets is LC_CTYPE
.
LC_CTYPE=ru_RU.KOI8-R luit ls # run one command
LC_CTYPE=ru_RU.KOI8-R luit # start a shell (type Ctrl+D or exit to return to the parent shell)
If you have a whole tree of files in a different encoding, I recommend (if possible) mounting it through convmvfs.
mkdir ~/net/[email protected] ~/net/[email protected]
sshfs [email protected]: ~/net/[email protected]
convmvfs -o srcdir=~/net/[email protected],icharset=KOI8-R,ocharset=UTF-8 ~/net/[email protected]
ls ~/net/[email protected]
Probably, one might consider using some complex terminal emulators like screen (on either end) that would translate the characters, (or use some translating extension to ssh...), or one could set up a convmvfs view of the filesystem remotely (with filenames recoded to the local encoding), but there is a simple solution:
just create an "environment" on the local host specially for working with that remote host, and work in this envoronment (run ssh, etc.), namely, in the situation when the remote filenames are in CP1251, start a fresh terminal in X that would work with that encoding:
$ LC_CTYPE=ru_RU.CP1251 xvt &
and work from it. (If you like Linux console more than X, probably you could set up a virtual linux console accordingly, but the knowledge about setting up the Linux console has been evaporating from my head...)