Note: I recently purchased a Synology DiskStation DS411j & I’m putting up posts about things I figure out. This is part of that series.

By default, the Synology DiskStation DS411j doesn’t support UTF-8 on the terminal. The GUI is a different story. I used the GUI to create a test file named this:


Sure enough, it looked fine in the GUI, but when I looked at via the command line, I saw this:


Ugh. Why this isn’t set up by default is beyond me, but here’s what you have to do to fix this. It’s not awful, but it’s a lot more work than we should have to do.

Begin by finding out which CPU your Synology DiskStation uses.

Head over to the SourceForge page that Synology has created for the Synology NAS GPL Source (yep, they’re good open source citizens, & they publish their source) & find the right link for the DSM Tool Chains. In my case, it’s the DSM 3.2 Tool Chains. On the following page, click on the link for the processor found in your DiskStation; for me, it’s the Marvell 88F628x Linux 2.6.32 (I had to follow links to figure out which one; it’s not obvious). Finally the file to download is there: gcc421_glibc25_88f6281-GPL.tgz. cd into a temp directory & download that file (it’s pretty big, btw—about 109 MB):

> cd /volume1/@tmp
> wget

Extract the source code you downloaded:

> tar -zvxf gcc421_glibc25_88f6281-GPL.tgz

Create a locale directory on the DiskStation:

> mkdir /usr/lib/locale

Copy 2 files (locale & localedef) & a directory (i18n) to their proper locations1:

> cp /volume1/@tmp/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/bin/locale /opt/bin/
> cp /volume1/@tmp/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/bin/localedef /opt/bin/
> cp -R /volume1/@tmp/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/share/i18n/ /usr/share

Test to see if locale works & see what the current locale is:

> locale -a

Now define the new locale with UTF-8:

> /opt/bin/localedef -c -f UTF-8 -i en_US en_US.UTF-8

Test to make sure the new locale has taken:

> /opt/bin/locale -a

Add the following lines to /etc/profile to use UTF-8:

# Added by RSG 2012 0109
export LANG LC_ALL

Restart the DiskStation:

> reboot

After the DiskStation is back up, test again to make sure UTF-8 is now the law of the land:

> locale 

Yup, UTF-8 is like kudzu—it’s everywhere on the DiskStation!

Let’s take another look at that test file I created that started this whole thing. Uh oh—when I went back & viewed the file I’d created initially, I still got the garbled filename: •test. That’s because it had been created before UTF-8 was set up as the locale.

I created a new file named •test using the GUI & looked at it on the CLI:

> ls

Perfect. The lesson? Set up the locale before you begin copying any files with UTF-8 characters in their names. I’m going to put that in its own paragraph & bold it so you notice it & take heed:

Set up the locale before you begin copying any files with UTF-8 characters in their names.

As I said, it’s not super hard to add the locale & set things to UTF-8, but I still don’t understand why buyers of the Synology DiskStation need to do it in the first place. Shouldn’t the OS on the DiskStation support UTF-8 out of the box?

  1. In setting up a friend’s DS212j, I moved the locale & localedef executables to a different location because /opt didn’t even exist. I checked my PATH:

    > echo $PATH

    Noting that /usr/local/bin was in my PATH, I decided to use that. However…

    > ls /usr/local
    cups  doc   etc

    Argh! /usr/local/bin doesn’t exist either! Oh well, that’s easy to fix:

    > mkdir /usr/local/bin

    Finally, I did my copy this way:

    > cp /volume1/@tmp/arm-none-linux-gnueabi/arm-none-linux-gnueabi/libc/usr/bin/locale* /usr/local/bin/