[systemsettings] [Bug 403557] UTF-8 characters are not saved correctly using the implicit path configuration module

Albert Astals Cid bugzilla_noreply at kde.org
Sun Feb 17 17:57:35 GMT 2019


https://bugs.kde.org/show_bug.cgi?id=403557

--- Comment #9 from Albert Astals Cid <aacid at kde.org> ---
(In reply to Jos van den Oever from comment #8)
> I've just written a test to recreate the issue.
> 
> void KConfigTest::testQStringUtf8()
> {
>     QTemporaryFile file;
>     QVERIFY(file.open());
>     KConfig config(file.fileName(), KConfig::SimpleConfig);
>     KConfigGroup general(&config, "General");
>     const QString value("Téléchargements");
>     general.writeEntry("Utf8", value);
>     config.sync();
>     file.flush();
>     file.close();
>     QFile readFile(file.fileName());
>     QVERIFY(readFile.open(QFile::ReadOnly));
>     // check that reading works
>     KConfig config2(file.fileName(), KConfig::SimpleConfig);
>     KConfigGroup general2(&config2, "General");
>     QCOMPARE(value, general2.readEntry("Utf8", QByteArray()));
> }
> 
> This passes. The é is escaped in the file. This is not needed. Any value
> above 126 is non-printable or valid UTF8 or another binary value.
> Not escaping valid UTF8 sequences is an improvement. But that is not the
> issue here.
> 
> "Téléchargements" is escaped on saving. That is fine. But it should be
> unescaped when loading. This happens in the test, but not in
> plasma-desktop/kcms/desktoppaths/globalpaths.cpp.

I guess because the loading is done through
QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Unassigned-bugs mailing list