Other Make HAL use UTF-8 locale when mounting FAT32/msdos


New Member

Messages: 1


I want HAL to mount my FAT32 drives with UTF-8 locales. Every time I mount FAT32 drives it's always in the default encoding instead of using UTF-8.

How do I make HAL to mount it with UTF-8 instead of default locales?

I already have the iconv modules loaded on boot as you can see on my /boot/loader.conf below:


Here's the command I use to mount FAT32 partitions with UTF-8 locales: mount_msdosfs -D UTF-8 -L en_US.UTF-8 -u 1001 /dev/da0 /media/drive.



Son of Beastie

Reaction score: 1,751
Messages: 3,568

We're talking about HALd right (hald(8))? Needed to run graphical environments such as Gnome and KDE.

Then the answer is very simple: you can't, because HALd doesn't mount media, that's what an auto mounter like autofs(8) is for.

If you read the manualpage you'll notice for yourself: all HALd does is maintain a database of devices which can then be used by other processes. But that's it.

So your best option here is to add the mount information to /etc/fstab, optionally set up an auto mounter and then the disks will always be mounted with the right locale and/or codepage.


Aspiring Daemon

Reaction score: 453
Messages: 700

While it is a better idea to use autofs nowadays,
but It is really possible to mount in UTF-8 locale, when using sysutils/hal.
I wrote these instructions two years ago, but, probably, it should still work fine.
In a nutshell, just execute this command:
gconftool-2 --set "/system/storage/default_options/vfat/mount_options" --type list --list-type=string "[longnames,-u=,-L=en_US.UTF-8]"It'll add "-L=en_US.UTF-8" to default "vfat" mount options and sysutils/hal should use this setting,
never had any problems after setting it, it used to work fine, when I used to use HAL.
To apply changes, also restart of hald service may be required.
Auto mount attached USB devices in UTF-8 locale with your file manager using HAL.
(Works with x11-fm/nautilus, x11-fm/thunar, x11-fm/pcmanfm… etc)
By default (with hald_enable="YES" in /etc/rc.conf) x11-fm/nautilus will auto mount with HAL all your attached USB devices, but it won't automount these devices in UTF-8 locale (even if your system locale is UTF-8 locale), so if there are some folders/files that use unicode symbols (✞✞☹☹☹✞✞) or hindi/arabic/cyrillic letters in its names — you won't be able to open it. So to change this appearance, install sysutils/gconf-editor, open it and navigate to /system/storage/default_options/vfat/mount_options and add

to its values (or another *.UTF-8 locale).

Or just enter

gconftool-2 --set "/system/storage/default_options/vfat/mount_options" --type list --list-type=string "[longnames,-u=,-L=en_US.UTF-8]"

and press return.


Active Member

Reaction score: 9
Messages: 185

Really great, had this only been posted a few years earlier or been in the handbook. Does this work for KDE5 as well, as this seems to be related to gconftool which I believe is Gnome-related?
Anyway, for over a year I am using dsbmc with xfce4 now and I am happy with that. My external NTFS-drive, my camcorder and my mobile phone get mounted automatically in caja or thunar.


Aspiring Daemon

Reaction score: 453
Messages: 700

Does this work for KDE5 as well, as this seems to be related to gconftool which I believe is Gnome-related?
"-L=en_US.UTF-8" flag should work with sysutils/hal no matter what window manager or DE you're using.
There is no need to install gconf-editor, just enter # gconftool-2 --set "/system/storage/default_options/vfat/mount_options" --type list --list-type=string "[longnames,-u=,-L=en_US.UTF-8]" , gconftool-2 should be already installed, it comes with devel/gconf2 package and many packages depend on it.