<table><tr><td style="">cfeck created this revision.<br />cfeck added reviewers: Frameworks, Dolphin.<br />Herald added a project: Frameworks.<br />Herald added a subscriber: kde-frameworks-devel.<br />cfeck requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D18161">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p><strong>[WIP/RFC] Please let me know if what I propose is sane</strong></p>

<p>UNIX filenames can contain any bytes (except <tt style="background: #ebebeb; font-size: 13px;">\0</tt> and <tt style="background: #ebebeb; font-size: 13px;">/</tt>). Qt's <tt style="background: #ebebeb; font-size: 13px;">QFile::decodeName()</tt> calls <tt style="background: #ebebeb; font-size: 13px;">QString::fromLocal8Bit()</tt>, assuming that all filesystems use the system's locale encoding. For filenames that have been created with a different encoding, and have not yet been converted (e.g. using <tt style="background: #ebebeb; font-size: 13px;">convmv</tt>), this creates non-reversible U+FFFD (REPLACEMENT CHARACTER) code points in the filenames.</p>

<p>For example, some old-style archives might not contain any information about the encoding of the filenames, and even today archivers extract them without trying to convert to the locale's encoding.</p>

<p>While full support for those filenames is not needed, Dolphin should at least be able to delete, rename, and move those files. Since all actual (local) file handling is done inside the <tt style="background: #ebebeb; font-size: 13px;">file</tt> kioslave, patching Dolphin will not help.</p>

<p>This code is a near verbatim copy of the code we had in kdelibs, written by Szókovács Róbert. Only minor adaptions to Qt5 were done. It decodes invalid bytes as U+10FExx from Plane 16 (Supplementary Private Use Area-B) to be able to encode them later.</p>

<p>Dolphin could detect filenames with those characters, and either mark them (by color or overlay icon), or even automatically offer to rename them.</p>

<p>CCBUG: 204768<br />
CCBUG: 165044</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>touch "/tmp/test-"$'\377'".txt"<br />
dolphin /tmp</p>

<p>Copying and deleting a test file worked with this code, failed without.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R241 KIO</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D18161">https://phabricator.kde.org/D18161</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/ioslaves/file/CMakeLists.txt<br />
src/ioslaves/file/file.cpp<br />
src/ioslaves/file/legacycodec.cpp<br />
src/ioslaves/file/legacycodec.h</div></div></div><br /><div><strong>To: </strong>cfeck, Frameworks, Dolphin<br /><strong>Cc: </strong>kde-frameworks-devel, michaelh, ngraham, bruns<br /></div>