NSLU2-Linux
view · edit · print · history

How to use international characters on OpenSlug

This howto provides you with the necessary instructions to correctly configure the locales on your OpenSlug and configure Samba so special characters display the same on the network as on the shell. To this end, we will use an ISO 8859-1 character set. You can use another character set if you want/need, but use the same one as your Windows machine (ISO 8859-1 in most cases) if you intend to use ext2 IFS (http://www.fs-driver.org).

TODO: someone should try this with the ISO 8859-15 character set and verify if it enables the euro curreny symbol.

NOTE: samba doesn't take the ISO 8859-15 chartset => conversion not supported

Symptoms

  • when uploading files via SFTP, any non-Ascii character is replaced with an underscore when browsing the SMB share
  • when uploading files via SMB, any non-Ascii character will be seen as giberish when viewed via SFTP or on the shell
  • 8-bit characters in filenames are printed as '?' in the output of ls

Cause

  • the only available locales on the slug are 'C' and 'POSIX' which only support ASCII characters
  • by default, Samba will save all filenames as UTF-8

Required packages

install the following packages from the feed:

  • glibc-localedata-en-us
  • glibc-gconv-iso8859-1
  • glibc-utils
  • glibc-charmap-iso-8859-1
  • localedef

If you want to use UTF-8 you should install the following package instead of glibc-charmap-iso-8859-1

  • glibc-charmap-utf-8

NOTE: If you want to install fr-CH in place of en-US, you should have installed glibc-localedata-fr-ch AND glibc-localedata-de-ch !

Building locale


localedef -i en_US -f ISO-8859-1 en_US to make sure it worked: check the output of
locale -a it should include en_US and en_US.iso88591

If, instead, you want an UTF-8 or other locale type something like
localedef -i en_US -f UTF-8 en_US.UTF-8 You might get a message that the process was killed. That means you need more RAM. Temporarily create a bigger swap partition. 32MB swap was not enough for me, so I created a 128MB swap file that I used.

Note: check if all directories needed are present! me gots an "no such file or directory" error. use localedef --help and check the System's directory

Note 2: With openslug, localedef gave an error "cannot create temporary file: No such file or directory". Checking with strace told that localedef tried to create a file in directory /usr/lib/locale, which didn't exist. mkdir /usr/lib/locale fixed that.

Configuring locale

edit /etc/profile and add the following lines:
LC_CTYPE=en_US export LC_CTYPE

Iconv setup

verify the iconv setup using iconv -l. 'ISO_8859-1' should be somewhere in that list. If not, you are missing one of the glibc-gconv-* packages.

Configuring samba

in the global section of /etc/samba/smb.conf, add a line that says unix charset = ISO-8859-1 test your configuration with testparm, if it complains about not being able to convert character sets, check you iconv setup. If you want to connect with a unix smbclient, be sure to add dos charset = UTF8 as they are using the dos level for communication. Also add 'codepage=utf8' as option to smbclient/smbmount. Changing the 'dos charset' is necessary in this case as it defaults to ASCII. You don't need a line, however, if you only intend to use XP/2K-clients.

Done

restart samba & log out


Setting Midnight Commander (mc)

go to Options->Display bits... and set ISO 8859-1

view · edit · print · history · Last edited by Tobbe.
Based on work by Tobbe, MuxF_anon, nowrap, Fabian, Becol_BE, mathieu_xwave, uoams, Nikolaj Schumacher, and becol_be.
Originally by becol_be.
Page last modified on April 14, 2009, at 10:45 PM