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

yuki_is_bored

New Member


Messages: 1

Hello,

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:
Code:
...

libiconv_load="YES"
libmchain_load="YES"
cd9660_iconv_load="YES"
msdosfs_iconv_load="YES"

...
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.

Thanks
 

ShelLuser

Son of Beastie

Reaction score: 1,726
Messages: 3,546

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.
 

ILUXA

Aspiring Daemon

Reaction score: 439
Messages: 682

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
Code:
-L=en_US.UTF-8

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.
 

cabriofahrer

Active Member

Reaction score: 8
Messages: 145

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.
 

ILUXA

Aspiring Daemon

Reaction score: 439
Messages: 682

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.
 
Top