SAMBA and special characters (accents, ñ…)

Normally you don’t use strange characters in filenames – you don’t want problems. But this doesn’t mean it can’t be done, neither we should avoid it. In fact, applications like Word uses the first line of the document (the title) to suggest a default filename to the user, so if title has accents, so will filename…

Unfortunately, SAMBA doesn’t seem to be prepared to show this filenames by default, and substitutes them with an underscore (“_”), so we should change the configuration this way:

SAMBA as a client: that is, when you want to reach remote files from your linux box.

Long ago, when we used SMB driver with mount, we should use option “nls=utf8”:

mount -t smb //REMOTE/shared /mnt/remote/shared -o credentials=FILE,nls=utf8

Now, CIFS driver (the one that substitutes SMB driver because it’s totally obsolete) is prepared by default, so there’s no need:

mount -t cifs //REMOTE/shared /mnt/remote/shared -o credentials=FILE

After that, you can be confident and do a touch /mnt/remote/shared/tomàs_núñez.txt , and the file will be created without problems.

SAMBA as a server: that is, when we want to share our linux documents to other machines.
In this case we should add two lines to config file smb.conf (usually /etc/samba/smb.conf):

dos charset = 850
unix charset = ISO8859-15

This way, files will be shared with accents in filenames, ñ and so on!

Tomàs

Tomàs

I'll make something up

  • Anonymous

    Per a cifs et falta l’opció: iocharset=utf8
    Sense aquesta opció, intento accedir a un share de win xp que té directoris amb accents i no puc accedir al contigunt mostrant-me caràcters ? en comptes dels accents i caràcters especials.
    Curiòs haver arribat al teu blog fent consultes sobre accents i samba.

    Oriol P.

    • Diederik

      Thanks a lot, this is exactly what I was looking for!