diff --git a/src/corelib/io/qurlrecode.cpp b/src/corelib/io/qurlrecode.cpp index f22df7a5afd..7f83033b3db 100644 --- a/src/corelib/io/qurlrecode.cpp +++ b/src/corelib/io/qurlrecode.cpp @@ -22,7 +22,7 @@ enum EncodingAction { // sub-delims = "!" / "$" / "&" / "'" / "(" / ")" // / "*" / "+" / "," / ";" / "=" static const uchar defaultActionTable[96] = { - 2, // space + 0, // space 1, // '!' (sub-delim) 2, // '"' 1, // '#' (gen-delim) @@ -648,8 +648,8 @@ qt_urlRecode(QString &appendTo, QStringView in, memcpy(actionTable, defaultActionTable, sizeof actionTable); if (encoding & QUrl::DecodeReserved) maskTable(actionTable, reservedMask); - if (!(encoding & QUrl::EncodeSpaces)) - actionTable[0] = DecodeCharacter; // decode + if (encoding & QUrl::EncodeSpaces) + actionTable[0] = EncodeCharacter; if (tableModifications) { for (const ushort *p = tableModifications; *p; ++p) @@ -669,9 +669,6 @@ qsizetype qt_encodeFromUser(QString &appendTo, const QString &in, const ushort * actionTable['[' - ' '] = EncodeCharacter; actionTable[']' - ' '] = EncodeCharacter; - // Apply !EncodeSpaces, same as qt_urlRecode() above - actionTable[0] = DecodeCharacter; - if (tableModifications) { for (const ushort *p = tableModifications; *p; ++p) actionTable[uchar(*p) - ' '] = *p >> 8;