# Midnight Commander + SMB char problem



## free-and-bsd (Apr 5, 2016)

Hello everyone.

I've read tons of posts about this, but it doesn't help.
The problem:
misc/mc has the ability to connect to SMB/CIFS share via `cd smb://user@server/share` command. It works all right (though a bit slow), but in a share connected this way non-latin (cyrillic in my case) character names aren't shown properly -- I see a single "?" instead.

What makes it more weird is that mc shows such filenames on the _local_ filesystem all right.
Neither is it related to my terminal app (x11/rxvt-unicode), nor to mc's own settings for that matter (Options > Display bits> 8 bit etc.).
When I, for the sake of testing, mount such SMB share using command like 
	
	



```
sudo mount_smbfs -E utf8:cp866 -I 192.168.0.7 -N -U anonymous //guest@server/myshare /mnt/point
```
, I can then see all the cyrillic filenames under the local mount /mnt/point in mc.

What makes the difference between these two smb-mounting methods is that mount_smbfs command only supports some early SMB protocols, as I learned from the devel mailing list. Latest SMB protocols are only supported via SAMBA port and this is not going to change any time soon... and as I understand, misc/mc uses SAMBA libs for this operation.

Again, not a problem for me and my situation, but for the sake of clarity and having a more or less usable Midnight Commander it would be nice to have this figured out somehow.


----------



## free-and-bsd (Apr 5, 2016)

What is interesting regarding misc/mc and SMB interaction, the Makefile contains these lines:

```
SMB_CONFIGURE_WITH=  smb-configdir=${LOCALBASE}/etc \
  smb-codepagedir=${LOCALBASE}/etc/codepages
```
Of course, no such file exists, neither have I found any references to it anywhere except for some old O'Reily books.


----------



## Phishfry (Apr 5, 2016)

I am assuming you went thru this page thoroughly? 
https://www.freebsd.org/doc/handbook/lang-setup.html

This stands out to me.
To configure support for Russian filenames in mounted MS-DOS® file systems, include -L and the locale name when adding an entry to /etc/fstab


----------



## free-and-bsd (Apr 5, 2016)

Phishfry said:


> I am assuming you went thru this page thoroughly?
> https://www.freebsd.org/doc/handbook/lang-setup.html


Did that a long time ago, at the time of the initial install -- it was FreeBSD 9 then. Besides, I was more interested in French locales at the time, than Russian (I personally prefer keeping things in English for some well known reasons).

Tried this solution once to fix the broken cyrillic names on USB flash drives that come from Windows, and it _didn't_ help. You see, my problem is not about setting the language of my_ login shell_ or system messages to Russian (don't see why I should), nor is it about a missing _keymap_ or _X11 fonts_, which are defined in /etc/rc.conf as per that section.
As I wrote above, my console _does_ show cyrillic characters for such filenames on my local filesystem. I can even type Russian in my console when switched to it using setxkbmap.

Even if that was not enough, there is a way to start Midnight Commander in Russian:

```
LANG=ru_RU.UTF-8 mc
```
 This gives me mc with prompt and menus in Russian yet doesn't fix the problem in question. I think it is of the same order as that of not being able to display Russian file names in pcmanfm for the USB flash drives that come from under Windows, while showing them all right for locally created Russian file names.


> This stands out to me.
> To configure support for Russian filenames in mounted MS-DOS® file systems, include -L and the locale name when adding an entry to /etc/fstab


Thanks a lot, but I'm not talking about mounting MS-DOS® file systems. It's about displaying CIFS shares.
EDIT: the problem is, there's not way to specify locale when accessing CIFS shares via mc.
You're supposed to be able to change something about displaying characters by going to Options --> Display bits --> Input / display codepage: [...], but this fails to help with my problem. Doesn't seem that changing codepage in that setting box does indeed change _anything_... Looks like SAMBA interaction in mc doesn't take into account those code pages, or is buggy.


----------

