Bug 338391 - Krusader (normal_vfs) does not handle unicode file names properly on mounted NTFS drives
Summary: Krusader (normal_vfs) does not handle unicode file names properly on mounted ...
Status: RESOLVED WORKSFORME
Alias: None
Product: krusader
Classification: Applications
Component: general (other bugs)
Version First Reported In: Git
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Krusader Bugs Distribution List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-19 21:40 UTC by Pete
Modified: 2018-05-06 00:16 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Fixes umlauts in file systems with different charsets (641 bytes, patch)
2014-08-19 21:40 UTC, Pete
Details
Screenshot of the issue (in the path field, names are correctly shown) (85.15 KB, image/png)
2014-08-19 21:42 UTC, Pete
Details
This seems to fix all issues (1.92 KB, patch)
2014-08-21 21:56 UTC, Pete
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pete 2014-08-19 21:40:30 UTC
Created attachment 88326 [details]
Fixes umlauts in file systems with different charsets

I'm using Ubuntu 14.04 and initially the krusader package. However, when mounting my NTFS drives through KDE's dolphin, file names with umlauts were shown wrong in Krusader (but correctly in Dolphin). 

I downloaded the git master and skimmed through VFS/normal_vfs.cpp and found 
name = QString::fromLocal8Bit(dirEnt->d_name);

I assumed that the file names from the NTFS drive were not Local8Bit and this is were the error comes from. I downloaded the dolphin sources to see how it is handled there which brings us to:

name = QFile::decodeName(dirEnt->d_name);

I recompiled the sources and the error was gone. 

TLDR: Krusader list panel expects 8Bit string for file names and therefore does not work with different charsets. Added a patch.
Comment 1 Pete 2014-08-19 21:42:49 UTC
Created attachment 88327 [details]
Screenshot of the issue (in the path field, names are correctly shown)
Comment 2 Pete 2014-08-19 22:06:01 UTC
The fix does only fix the listing of the folder, however the folder is still not accessible. I do not know how to fix this.
Comment 3 Pete 2014-08-21 21:56:40 UTC
Created attachment 88359 [details]
This seems to fix all issues

As KDE Dolphin showed correct umlauts in the file names and all folders were accessible, I studied their source and adopted the behavior to konqueror. 

Instead of using toLocal8Bit, Dolphin uses the QFile::encode/decodeName() methods. 

Files and folders with umlauts on mounted NTFS drives are now accessible. However opening these URLs in Chrome or VLC still results in encoding issues, but KDE's native apps all seem to work fine. If I fix the encoding of the url to work in Chrome or VLC, all the native KDE apps start complaining. So there might be some deeper issues.
Comment 4 Simon Persson 2015-06-30 13:31:54 UTC
At least in Qt5, QFile::encodeName() looks like this:

static inline QByteArray encodeName(const QString &fileName)
    {
        return fileName.toLocal8Bit();
    }

So for sure there would be no point in using this patch nowadays (on Qt5 version of krusader I mean, and it currently does not look like anybody will be releasing any more version of the Qt4 code).

If a filesystem has filenames encoded in a different character encoding than the system, it would have to be specified as a mount option I believe, either detected automatically by system software (udisks or such) or specified manually. I don't think there is anything thatKrusader should be doing to fix those situations. 
But I'm not confident enough about that, so I'll leave this bug open. Needs more research.
Comment 5 Alex Bikadorov 2016-10-09 19:12:14 UTC
tested filenames with umlauts on NTFS partition, works fine here.
If I remember right there was always a problem with Windows FS encodings: ISO8859-1 versus UTF. But this is not related to Krusader.