[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 161588] Flash disk mounted with wrong codepage and/or charset
From:       Fredrik Johansson <fredrik () mumme ! se>
Date:       2008-06-08 13:42:45
Message-ID: 20080608134245.4027.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=161588         




------- Additional Comments From fredrik mumme se  2008-06-08 15:42 -------
I am also seeing this behaviour, as I live in sweden I am using a LANG=sv_SE.UTF-8 \
locale.

Here is how shows up for me.


I use a USB flash memory stick to move files between home and work, at my work there \
is only windows XP (with a swedish locale also). 

The memorystick is formatted as FAT32 (like most flash memorysticks), using chcp in \
win xp command prompt reveals that windows mounts the drive as: codepage 850
charset utf-8

When I get home again and stick my flashdrive in my kubuntu 8.04 KDE4 machine, It \
mounts but without the much needed iocharset=utf8 mount option. 

So every file or folder with a localized name displays ? in and can't be opened.

For example:
  Pupil_jobs/
     SörenAndersson.doc
     ÖstenÖrkenrud.doc
     ...

becomes:
  Pupil_jobs/
     S?renAndersson.doc
     ?sten?rkenrud.doc
     ...

You cant open those files in any tool or application

However if I umount and use pmount or mount them manually with iocharset=utf8 option, \
I can browse my files without a problem.

Searching the web for a solution, I only found a deprecated way to use merge keys in \
HAL .fdi files (volume.policy.mount_options.iocharset), but have never been supported \
by KDE (according to several archive mailing lists)

The other solution recomended for kde (by people on some forums) was to edit \
/etc/fstab, thus eliminating the use of HAL.

HAL developers says that application writers knows better about which iocharset the \
user wants and therefore has deprecated volume.policy.* and it looks like KDE \
developers trust HAL to know best. At least from what I can make of it by looking at \
the code.

This issue seems to have been debated for a long time
http://bugs.kde.org/show_bug.cgi?id=133456

So currently the automount feature is more or less crippled in kde for everybody not \
using english locale.

I really which this bug could be solved...

In the meantime I wrote up a quick hack for solid/backend/hal/halstorageaccess.cpp \
that works for me, it just uses utf8 if its the system default charset.

Index: solid/solid/backends/hal/halstorageaccess.cpp
===================================================================
--- solid/solid/backends/hal/halstorageaccess.cpp       (revision 818361)
+++ solid/solid/backends/hal/halstorageaccess.cpp       (working copy)
 @ -25,6 +25,7  @
 #include <QtDBus/QDBusReply>
 #include <QtGui/QApplication>
 #include <QtGui/QWidget>
+#include <QtCore/QTextCodec>

 #include <unistd.h>

 @ -230,6 +231,14  @
     QStringList options;
     QStringList halOptions = \
m_device->property("volume.mount.valid_options").toStringList();

+    if ( halOptions.contains("iocharset=") ) {
+       QTextCodec *codec = QTextCodec::codecForLocale();
+       QString charset = QString(codec->name()).toLower();
+       if(charset == "utf-8"){ // for some reason, mount didnt like UTF-8, convert \
to utf8 +           options << "iocharset=utf8";
+       }
+    }
+
     if (halOptions.contains("uid=")) {
         options << "uid="+QString::number(::getuid());
     }

Regards
Fredrik Johansson


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic