Review Request 110043: Proposed fix/workaround for legacy encoded filename handling

Thiago Macieira thiago at kde.org
Fri Jun 28 16:35:10 BST 2013



> On June 28, 2013, 2:53 p.m., David Faure wrote:
> > Independently from this patch, I was thinking of a completely different approach to solve non-utf8 encodings in file:/// urls: using KRemoteEncoding in kio_file, just like we do in other slaves like kio_ftp. I.e. letting the user select the encoding by hand for the current directory. This way, not only would files be usable, but they could even appear correctly. However it requires manual user intervention, but that's the case anyway for FTP dirs that use another locale etc.
> > On the other hand it moves the fix "up to KIO", so it wouldn't work for other QFile uses.. [hmm, or anywhere where KIO has a fast path for local files to avoid calling kio_file.... Ouch, that might kill this idea completely, in fact].  Well, food for thought, then.

Using anything but the exact byte sequence in URLs breaks http://freedesktop.org/wiki/Specifications/file-uri-spec/.

That spec and RFC 3987 put together limit KDE to exactly one local filesystem encoding: UTF-8.


- Thiago


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/110043/#review35232
-----------------------------------------------------------


On June 28, 2013, 9:28 a.m., Róbert Szókovács wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/110043/
> -----------------------------------------------------------
> 
> (Updated June 28, 2013, 9:28 a.m.)
> 
> 
> Review request for kdelibs and Thiago Macieira.
> 
> 
> Description
> -------
> 
> This patch works around the problem of filenames that are not valid UTF8 strings:  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 to a specific value ("broken_names").
> 
> To test it, do the following: .kde/env/KDE_UTF8_FILENAMES.sh with this content: 
> export KDE_UTF8_FILENAMES=broken_names
> logout, login, try dolphin on faulty files. (instead of the usual boxed "?" you'll see just boxes)
> 
> 
> This addresses bug 165044.
>     http://bugs.kde.org/show_bug.cgi?id=165044
> 
> 
> Diffs
> -----
> 
>   kdecore/localization/klocale_kde.cpp b010e74 
> 
> Diff: http://git.reviewboard.kde.org/r/110043/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> Róbert Szókovács
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20130628/d86167bc/attachment.htm>


More information about the kde-core-devel mailing list