NFS i UTF-8

Posted on Wed 26 January 2005 in Tips4Unices • 3 min read

I created a few Japanese file and directory names in UTF-8 in Windows. Then I logged in from Linux (7.3) that is configured to run Japanese. From the login 'language' I can only select 'Japanese (eucJP)' (there is no Japanese (UTF-8)). I did a 'showmount -e 10.xxx.xxx.xxx' but I got scambled Japanese characters for those entries that are encoded in UTF-8. Then I switched the locale to ja_JP.UTF-8, but the same stuff was returned. What's wrong with this picture? Thanks, Jim


How did you mount Windows filesystem? With smbmount or NFS? If it's
NTFS that is mounted via samba, you have to specify 'iocharset=utf-8'.
If it's VFAT exported over the net, you also have to specify codepage(for Japane
se, it's 932). For local filesystems, specifying 'utf8' (and 'codep age=932' for VFAT) option to mount command would be sufficient. (see the m
an pages of mount(8) and fstab).
Needless to say, you have to run your shell in UTF-8 terminal (e.g. xterm 16x or
mlterm) to view UTF-8 characters.
Now in case of NFS, I have no idea how 'Windows NFS server' translates UTF-16 us
ed in NTFS and VFAT to multibyte encodings. There must be a server config. opti
on for that. (the default might be the 'ANSI' codepage of the current locale. Fo
r Japanese, it's Windows-932/Shift_JIS).
For Unix NFS server - Unix client, there's little need for encoding translation
although having one would be nice for some cases(e.g. EUC-JP on the server and U
TF-8 on the client-side)
Jungshik

It's an UNIX (Linux) to UNIX (NetBSD) mount. The UTF-8 Japanese file names are i
n my NetBSD:/etc/exports. I can only mount those entries that are ASCII equivale
nt. I also tried it from Solaris 8 (logged in as 'Japanese UTF-8 (Unicode)') and
it worked fine. I am sure if I can turn on UTF8 mode I should be able to do so.
I can't get it to work. 'xterm -u8' doesn't work. the locale never chan
ges.
From Solaris you can do a "LANG=ja_JP.UTF-8 dtterm &" and the new dtter
m has the right locale set.
What is mlterm? Couldn't find it on Linux 7.3.
Jim

NFS should be encoding-neutral just like the rest of Unix FS is. (except for cas
es like exporting to and from non-Unix systems where different file systems are
used.). Why don't you begin with a simpler case? Before using UTF-8 for director
y names to export via NFS, you can begin with making sure UTF-8 filenames under
a NFS-exported directory come out all right on the client side. BTW, I've just
experimented with UTF-8 directory names in export list(/etc/exports), it worked
fine between Mandrake 9.0(server) and RedHat 8.0(client). Judging from this and
the fact that Solaris and NetBSD worked fine, it should also work between NetBS
D and RH 7.3
You have to do the same for xterm as you do for dtterm. 'LANG=ja_JP.UTF-8 xt erm'. '-u8' option is not necessary for recent xterm. Or, you can
do in the opposite order. That is, run 'xterm -u8' and then set LANG to
ja_JP.UTF-8 in xterm (UTF-8). Actually, you have to do the latter way if your <
em>/etc/sysconfig/i18n or ~/.i18n sets $LANG to a value o
ther than ja_JP.UTF-8 because the shell initialization script in RedHat
*overrides* the value set before the shell invocation with the value in /et c/sysconfig/i18n or ~/.i18n.
(see /etc/profile.d/lang.(sh|csh)).
I'm not sure if it's in RH 7.3. You can get it at: