Bug 411243

Summary: Average file size unit in the tooltip has wrong encoding
Product: [Applications] filelight Reporter: Ruslan Kabatsayev <b7.10110111>
Component: generalAssignee: Martin Sandsmark <martin.sandsmark>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Microsoft Windows   
Latest Commit: Version Fixed In: 19.08.2
Sentry Crash Report:
Attachments: Screenshot of the problem

Description Ruslan Kabatsayev 2019-08-24 10:54:14 UTC
Created attachment 122322 [details]
Screenshot of the problem

SUMMARY
When average file size is reported in a tooltip, like "N files, with an average size of X KiB\nY MiB" on a Russian-localized Windows, "KiB" is apparently translated into Russian "КиБ", but, instead of displaying it properly, it's showed as if the text were stored in UTF-8 and read as CP1251, resulting in "РљРёР‘" (which is mojibake). Interestingly, "MiB" does get translated properly into "МиБ".

STEPS TO REPRODUCE
1. Install the "latest version" of Filelight for windows from https://utils.kde.org/projects/filelight/ (which is 17.12.0 as of this writing).
2. Run Filelight, point it to a directory with multiple multi-kilobyte files in addition to several larger ones
3. Hover over the dark-red-colored sector, look closely at the tooltip.

OBSERVED RESULT
Unit for average file size has wrong encoding, while that of total size is OK.

EXPECTED RESULT
Both units should look properly.

SOFTWARE/OS VERSIONS
Windows: 7 Starter SP1 32 bit
KDE Frameworks Version: 5.37.0
Qt Version: 5.9.1

ADDITIONAL INFORMATION
A screenshot is attached.
Comment 1 Christoph Feck 2019-09-21 12:55:25 UTC
Git commit 69a707b455739d6acac56a52e1953b9e8b283031 by Christoph Feck.
Committed on 21/09/2019 at 12:52.
Pushed by cfeck into branch 'Applications/19.08'.

Fix encoding of size tooltip in radial map

class File (see fileTree.h) internally stores filenames in
8 bit encoding. The size tooltip uses the same API, but does
not correctly encode the tooltip to 8 bit. It uses UTF-8,
while the system might have a different local encoding.

Changing toUtf8() to QFile::encodeName() fixes this.
FIXED-IN: 19.08.2

Reviewed by: aacid

Differential Revision: https://phabricator.kde.org/D24013

M  +1    -1    src/radialMap/map.cpp

https://commits.kde.org/filelight/69a707b455739d6acac56a52e1953b9e8b283031