-
-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Qt4] Files and directories with UTF-8 special characters in the name not read correctly #61
Comments
Log:
|
There is fromUtf8() missing maybe? Or fromLocal8Bit() can be better (using locale)? Using QFile::encodeName is another approach. |
No, it's there: https://github.com/shundhammer/qdirstat/blob/master/src/DirReadJob.cpp#L179 What filesystem type is that? Are there any special mount options? |
See also issue #19: It works in general, for both files and directories with UTF-8 special characters. Something must be different in your setup. |
You use toUtf8() on input parameters to libc functions, but not fromUtf8() while storing them into QString. Problem doesn't depends on filesystem type - all (ext4, cifs, nfs) mounted with utf8 support and working with Qt/CLI apps. BTW: when dirname with UTF-8 chars is given as starting parameter this name is working correctly: logfile for
|
The issue is about skipping/ignoring files and dirs, not displaying them. As you can see dir with wrong chars is treated as file, all such files are reported as empty (0 bytes). |
The polish letter ą is supported by my config using UTF-8 locale:
As you can see all works when use 2-byte encoding with 0xC4 0x85. But QDirStat is trying to use 4 bytes 0xC3 0x84 0xC2 0x85:
|
And as you can see 0xC3 0x84 is UTF-8 encoded ASCII char 0xC4. In my opinion QDirStat is doing something like toUtf8(toUtf8(QString)). And when you don't use toUtf8 (like in command line params) there is no error. |
You are right, of course. Added that missing fromUtf8() call. One thing I don't understand at all, though, is why it ever worked for me. I also have a UTF-8 environment (de_DE.utf8), and as you can see from the screenshots, not only did it display those files and directories, it also correctly displayed their metadata (size etc.). OTOH the Qt docs explicitly say that it uses fromUtf8() by default when constructing a QString from a const char *: |
Does it work for you with commit e4cf683 ? |
Just a thought: Are you using QDirStat built with Qt 4.x? In Qt 4.x, the QString constructor from const char * used fromAscii() rather than fromUtf8(). That might explain the different behaviour. I am not 100% sure, but I think NHellFire's PPA builds QDirStat against Qt 4. |
Bingo. I just downloaded and unpacked it, and voila:
So if you are using that version of QDirStat, that would perfectly explain the discrepancy between your and my results. But anyway, explicitly doing the conversion fromUtf8() and not relying on implicit behaviour is definitely the more reliable way. |
Please reopen if commit e4cf683 did not fix the problem for you. |
I've tested it with qt4 and qt5 and both work ok now. |
Thanks for confirming this! |
version: 1.3
system: Ubuntu zesty
package: 1.3-1~zesty (amd64)
All files and directories with polish (or Cyrillic) characters are skipped/ignored in QDirStat:
Works without problems in all other KDE/QT/CLI apps:
The text was updated successfully, but these errors were encountered: