It seemed to me that I had already explained how to set the locale… Well, it seems not, so let me repair this slight. It is quite easy: you install the getlocale extension, and use it to generate a custom “mylocale” extension, where some UTF-8 locales are enabled. Be sure to load this “mylocale” extension on boot, and change your boot-manager’s settings so that the Linux kernel is given this additional parameter (for example):

linux […] lang=fr_FR.utf8

The way I do things, this new parameter is actually defined in a variable and then the variable is used on the linux line.

But this is not enough. With just this part being done, I still have some worries, like ROX-Filer warning me that this or that file on the flash drive does not have a valid UTF-8 name and should be renamed, or the terminal displaying garbage whenever I type a non-ASCII character, or fonts limited to ISO-8859-1 symbols…

So, first, let’s make sure the xfonts-unifont extension is loaded at boot. This will cover characters for most European languages. Other fonts may have to be installed, for Japanese or Chinese for example.

Next, let’s change both the terminal and the shell. Indeed, neither TinyCore’s default terminal (aterm) nor TinyCore’s default shell (busybox sh) supports UTF-8.

For the terminal, I chose rxvt-unicode, also known as “urxvt”, because it is stable, feature-complete, and small. “st-xft” is even smaller and also an option, as well as bigger terminals like “gnome-terminal”. To enable the change, I make sure that “rxvt-unicode” is loaded at boot, and I create a symbolic link to /usr/local/bin/urxvt named aterm in the PATH so that the default terminal button in TinyCore’s wbar launches my choice of terminal instead of the real “aterm”. In my case:

tc@flash:~$ ln -s /usr/local/bin/urxvt ~/.local/bin/aterm

Of course, I also ensure that my ~/.local directory is saved by TinyCore across reboots, and that ~/.local/bin is in the PATH. In fact, I also create a similar symbolic link with the name xterm; it helps sometimes…

For the shell, I chose bash, the default shell for most Linux distributions. But I do not want to change my default shell in /etc/passwd, in case one day I have to boot without loading extensions; then “bash” wouldn’t be available and I risk not being able to login at all! So instead I simply create an executable file in /home/tc/.X.d/ with this content:

export SHELL=/usr/local/bin/bash

Last but not least, the hardest part in fact, I want partitions (FAT in particular) to be mounted with the UTF-8 charset, not ISO-8859-1. To achieve that, it is necessary to alter TinyCore’s core.gz file. That’s because the change has to apply right from the start of the boot process, before the partition with the extensions on it is mounted. To this end, I have to run these commands (adapt core.gz’ path to your situation):

mkdir core; cd core
gzip -dc /mnt/FLASH/.boot/corelnx/core.gz | sudo cpio -i
sudo sed -i 's#\(ntfs\|msdos\|fat\))#\0 grep -qi "lang=[^ ]*utf8" /proc/cmdline \&\& OPTIONS="${OPTIONS},iocharset=utf8"; #' usr/sbin/rebuildfstab
find . | sudo cpio -H newc -o | gzip -9 >../core.gz
cd ..; rm -rf core
tce-load -il advcomp
advdef -z4 core.gz

The truth is I actually just merge the above one-long-line “sed” command [1] with my already-existing script, just below the “sed” command that makes NTFS-3G the default NTFS handler. But that does not change a thing. There only remains to rename the former core.gz file, and put the new one in its place, then boot from it.

If, however, you boot TinyCore Linux from a partition where the charset is not an issue (a dedicated /boot partition, or an Ext2 partition…), then all you have to do is add these lines to /opt/ (much simpler, isn’t it?):

sed -i 's#\(ntfs\|msdos\|fat\))#\0 grep -qi "lang=[^ ]*utf8" /proc/cmdline \&\& OPTIONS="${OPTIONS},iocharset=utf8"; #' /usr/sbin/rebuildfstab

So far, all those changes seem to be enough to enjoy UTF-8 without problems arising. See also this post about bash, though.

[1] I changed the command to be more specific to Microsoft filesystems, as the previous command did not work well with other filesystems.