D17651: Escape bytes that are larger than or equal to 127 in config files
Jos van den Oever
noreply at phabricator.kde.org
Sat Dec 29 17:05:15 GMT 2018
vandenoever added a comment.
Here is a patch that solves the problem:
diff --git a/src/core/kconfigini.cpp b/src/core/kconfigini.cpp
index 39e5936..b674973 100644
--- a/src/core/kconfigini.cpp
+++ b/src/core/kconfigini.cpp
@@ -673,7 +673,12 @@ QByteArray KConfigIniBackend::stringToPrintable(const QByteArray &aString, Strin
switch (s[i]) {
default:
// The \n, \t, \r cases (all < 32) are handled below; we can ignore them here
- if (((unsigned char)s[i]) < 32 || ((unsigned char)s[i]) >= 127) {
+ if (((unsigned char)s[i]) < 32) {
+ goto doEscape;
+ }
+ // GroupString and KeyString should be valid UTF-8, but ValueString
+ // can be a bytearray with non-UTF-8 bytes that should be escaped.
+ if (type == ValueString && ((unsigned char)s[i]) >= 127) {
goto doEscape;
}
*data++ = s[i];
REPOSITORY
R237 KConfig
REVISION DETAIL
https://phabricator.kde.org/D17651
To: vandenoever, dfaure, arichardson, apol
Cc: aacid, apol, kde-frameworks-devel, michaelh, ngraham, bruns
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20181229/4f5daa67/attachment.html>
More information about the Kde-frameworks-devel
mailing list