[Samba] smbclient mangles share names

Ilya N. Golubev gin at mo.msk.ru
Fri Mar 2 21:04:38 GMT 2007

Version: 3.0.23a.  (2.0.10 does so in a quite different way, worthy of
another message.)

System: linux-gnu, `glibc-2.3.5-10'.

Remote share (and other file) names as `smbclient' outputs to user and
accepts from user, are mangled in an obscure way that somehow depends
on `LANG' environment variable.

The server provides directory share with cp866 name.  `smbclient -L'
may output or not output it.

If `LANG=en_US.UTF-8', it outputs it, correctly converted from cp866
to utf-8.  If pass this utf-8 string to `smbclient' as share name, it
connects to it properly.  `ls' in it also converts cp866 names to
utf-8 correctly.

Unfortunately, that `LANG' value is unacceptable for other reasons;
other values are preferred; after all, this is what variables are for.
Currently using other `LANG' values is impossible.  If change it to
`C', `ru_RU.CP866', if unset `LANG', `smbclient -L' does not output
non- ascii share names at all.  Neither passing the share name
(encoded in cp866, that is, as server actually sends it) to
`smbclient' works.

More information about the samba mailing list