Comment 149 for bug 510018

Revision history for this message
In , Szo (szo) wrote :

Created attachment 78460
Working fix

This attacment is a patch against kde4libs-4.10.1.
It works around the problem like this: in KLocalePrivate::initFileNameEncoding() KDE sets the QFile's encoding/decoding function, to to/fromUTF8() in QString, which in turn calls QUtf8's converter function (QUtf8 is not exported to developers, so I had to use an inefficient method, I think it would be better if we could use the state parameter for error detection). I replaced this with the said functions' copy/pasted version and changed it, so when it encounters an invalid UTF8 string, it will encode it byte by byte, mapping the lower 128 their normal unicode place and the upper 128 to U+18000-U+1807F, and of course the decoder reverses it.
To make this actually work you have to define the KDE_UTF8_FILENAMES enviroment variable (otherwise we would need to patch at QT level).
So, do the following:
.kde/env/KDE_UTF8_FILENAMES.sh
with this content:
export KDE_UTF8_FILENAMES=yesplease

logout, login, try dolphin on faulty files. (instead of the usual boxed "?" you'll see just boxes)

HTH