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

Thiago Macieira thiago at kde.org
Sun May 5 16:46:18 BST 2013


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


I don't like it. There's a reason why I removed the equivalent code from Qt and there's a reason I refuse to consider adding it back. At least you've made this about filenames only, so there's hope.

If you're going to use any range, I recommend using the same, old range from Qt 3 and early Qt 4.


kdecore/localization/klocale_kde.cpp
<http://git.reviewboard.kde.org/r/110043/#comment23902>

    Use the same range that Qt used from 2003 to 2007: U+10FE00 to 10FEFF



kdecore/localization/klocale_kde.cpp
<http://git.reviewboard.kde.org/r/110043/#comment23903>

    Don't check the BOM. No file names have BOM.



kdecore/localization/klocale_kde.cpp
<http://git.reviewboard.kde.org/r/110043/#comment23904>

    BOM handling again.


- Thiago Macieira


On May 5, 2013, 8:13 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 May 5, 2013, 8:13 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/20130505/6fa08e31/attachment.htm>


More information about the kde-core-devel mailing list