« Return to Thread: Review Request: fix kio_activities cannot handle utf8 file name/path

Re: Review Request: fix kio_activities cannot handle utf8 file name/path

by Bugzilla from ivan.cukic@kde.org :: Rate this Message:

| View in Thread

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

On July 12th, 2012, 4:20 p.m., David Faure wrote:

workspace/kio/kio_activities.cpp (Diff revision 1)
public:
215
                kio->listEntry(createUDSEntryForUrl(QUrl::fromPercentEncoding(it[1].toString().toAscii())), false);
This looks like a very ugly workaround, to me.

Does it[1].uri() return a QUrl, or a QString?
If a QString, then the problem is passing it to the QUrl constructor. QUrl in Qt4 is broken in that respect. (Fixed in Qt5).
Use KUrl instead, or use QUrl::fromEncoded(it[1].uri().toLatin1()). I'd prefer KUrl though, to keep this code readable and make it a one-char fix ;)

On July 19th, 2012, 12:45 a.m., Xuetian Weng wrote:

The problem is uri() return a QUrl, and the url inside it is already encoded. When it passed to createUDSEntryForUrl it actually encoded twice.

I wonder we should fix it in soprano or we should fix it when the original url is saved.
@Xuetian

Can you test the following instead of your proposed patch:
kio_activities.cpp:127         QByteArray encodedPath = QUrl::toPercentEncoding(url.url(), "", "/");

The percent encoding was there mostly for the slashes. I've tested it with cyrilic and non-ascii latin characters.

- Ivan


On June 18th, 2012, 6:09 a.m., Xuetian Weng wrote:

Review request for KDE Runtime and Ivan Čukić.
By Xuetian Weng.

Updated June 18, 2012, 6:09 a.m.

Description

The query result for the Uri is already encoded to PercentEncoding, thus url.url() will not get the correct url.

Not sure this should always handled in this case, or soprano itself (uri()) should be fixed.

Testing

Works here for utf8 file name.

Diffs

  • workspace/kio/kio_activities.cpp (8ef1f7b)

View Diff

 « Return to Thread: Review Request: fix kio_activities cannot handle utf8 file name/path