# mount_smbfs and problem with -E option



## calak (Nov 5, 2012)

Hello,

I really need help.

On my server called 'fbsd-srv' I try to mount win2003 share. Everything works, but not national characters translation. In that case Win2003 has polish code page CP1250.

My FreeBSD server 'fbsd-srv' has the following configuration:


```
[root@fbsd-srv ~]# uname -a
FreeBSD fbsd-srv.mydomain.pl 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Mon Nov  5 15:07:34 UTC 2012     [email]root@fbsd-srv.mydomain.pl[/email]:/usr/obj/usr/src/sys/GENERIC1_KC  amd64
```

2) The kernel has been compiled with added options:

```
options         NETSMB
options         LIBMCHAIN
options         LIBICONV
options         SMBFS
```
3)But regardless of that mount_smbfs(8) command is active or not the following command has a result:

```
[root@fbsd-srv ~]# kldstat -q -m libiconv.ko
[root@fbsd-srv ~]#
```
I think, the output should not be empty.

The mount_smbfs(8) command I've used is:

`# mount_smbfs -I 172.27.191.10 -E utf-8:utf-8  //user@server2003/share /mnt`

or

`# mount_smbfs -I 172.27.191.10 -E utf-8:cp1250  //user@server2003/share /mnt`


4) My locale for root user:

```
[root@fbsd-srv ~]# locale
LANG=pl_PL.UTF-8
LC_CTYPE="pl_PL.UTF-8"
LC_COLLATE="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_MESSAGES="pl_PL.UTF-8"
LC_ALL=
```
Putty, I am using as a terminal is setup to translate UTF-8.

I cannot see proper file names containing polish characters. Could anybody help me? Where am I doing wrong?

Krzysztof


----------



## calak (Nov 6, 2012)

Hello,

I have posted the thread titled "mount_smbfs and problem with -K option" - of course it is mistake there is no K-option. Do not ask any attention.   


I have the problem with -E option of the mount_smbfs utility and I really need help.


----------



## SirDice (Nov 7, 2012)

Threads merged, deleted double content.


----------



## T-Daemon (Nov 7, 2012)

Try without the -E option.

From Using Samba:



> *Internationalization*
> Starting with Samba 3.0, Samba supports Unicode "on the wire," requiring no additional effort on your part to support filenames and other text containing characters in international character sets.


----------



## calak (Nov 7, 2012)

I've already had tried the following command of course

`# mount_smbfs -I 172.27.191.10 //user@server/share /mnt`

that is without the -E option, but nothing changes.

I must mention here that the name of a test file, containing specific Polish national character does not change completely depending on the parameter "-E". It seems as if no translation process exists. The name of the test file simply looks like this 
"????ä¢˜???????????.txt"

Krzysztof


----------



## T-Daemon (Nov 8, 2012)

Just to rule it out, does the FreeBSD box/putty display polish characters by keyboard input or from a local file?


----------



## calak (Nov 8, 2012)

Thank You for your interesting of that problem.

Yes, that is via putty I can see polish letters typed in to text file for example.

Putty is set to assume received data to be UTF-8.
My locale is set to pl_PL.UTF-8
Via vi I'm able to type in to the text file polish characters.

K.


----------



## T-Daemon (Nov 9, 2012)

Please check the samba log for indications related to the Problem. You could also try converting the name of the test file from CP1250 to UTF-8.


----------



## calak (Nov 9, 2012)

I have even no samba installed, so samba log is unavailable perhaps. The mount_smbfs does not require to install samba server.
Relating to "You could also try converting ...." what do you mean ? Could you precise the utility you mean ?


----------



## T-Daemon (Nov 10, 2012)

Please ignore my last posting. Wrong assumptions have led me to terribly wrong conclusions. Sorry for the trouble.

Have you tried it with the kernel module libiconv.ko loaded?


----------



## calak (Nov 12, 2012)

I've made some tests with this library. 

Now, my system is 32 bit FreeBSD.

```
# uname -a
FreeBSD host.domain.pl 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Tue Nov  6 19:29:16 CET 2012     [email]root@host.domain.pl[/email]:/usr/obj/usr/src/sys/GENERIC1_KC  i386
```
The kernel has libiconv compiled in.

Under GENERIC kernel the libiconv was not compiled in and I tested how modules worked. Thus,
1) It was enough to run the mount_smbfs(8) to could be able to see (with kldstat(8)) that the libiconv.ko was loaded.
2) You could free load or unload libiconv.ko manualy (with kldload(8)), and mount_smbfs(8) did not 'protest' .

Earlier, my system was 64 bit FreeBSD and, finaly I decided to install 32 bit because I it seamed to be some problems with libiconv.ko. I noticed that running mount_smbfs(8) did not caused to load libiconv.ko. What was more when I tried to load it manualy the error arised saying something like "uncorrect library format ... ", so I decided to give up with 64 bit and I installed 32 bit.  

K.


----------



## T-Daemon (Nov 13, 2012)

Does that mean problem solved or still persisting? Be aware that the 8.2-RELEASE is not supported anymore due to end of life.


----------



## calak (Nov 13, 2012)

The problem still exists. Regardless of that the module libikonv.ko works as loadable module or is compiled in to the kernel no proper translation is made while mount_smbfs(8). It is realy frustrating, because I do not know if there is something bug in software or I am making someting stupid.


----------



## mnvn (Nov 26, 2012)

I've got exactly the same problem - and I'm also polish FreeBSD user.


I _think_ that the problem may lay in the fact, that NTFS file names are encoded in UTF-16, but we save them as UTF-8.


Krzysztof, try this: create file on FreeBSD machine (for example: Å¼Ã³Å‚Ä‡.txt) and upload it to Windows server. You will see that FreeBSD handles name correctly - in terminal or mc. Of course Windows not - it will assign two characters for each letter (for example: â”¼ and â• for Å¼).

However, if you create file on Windows server, FreeBSD will be unable to see thoses characters.


But if you use:

```
-E utf-8:852
```
it will see all names correctly.

I'm not sure if this is right solution, but for the first look, it works. Codepage 852 is also used in Windows Command Prompt.


----------



## -Rozi- (Oct 24, 2018)

mnvn, you pointed me in the right direction. Long story short: I needed to use `-E UTF-8:852` (mind the case) on my FreeBSD 11.2 to work. Otherwise, `mount_smb` silently fails: no output, returns non-zero.


----------

