summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDon Sanders <don.sanders@nokia.com>2011-01-21 16:23:28 +1000
committerDon Sanders <don.sanders@nokia.com>2011-01-21 16:23:28 +1000
commitcb9388fe7ed39d5ea0264b113a55a2e7ae6929e7 (patch)
tree1ea0da7b80456a1e7d769222e94efca093cd7a6e
parent5da986e5b82fbd63571def1f3896f7203e478afb (diff)
Fixes: i18n parsing in header fields
Task: NB#204181 Details: Be more liberal when parsing q encoded text. Don't conform strictly to rfc2047, but instead be more liberal when parsing to handle incorrectly formatted text due to bugs in other software.
-rw-r--r--src/libraries/qmfclient/qmailmessage.cpp22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/libraries/qmfclient/qmailmessage.cpp b/src/libraries/qmfclient/qmailmessage.cpp
index 7d4ad1e4..59539492 100644
--- a/src/libraries/qmfclient/qmailmessage.cpp
+++ b/src/libraries/qmfclient/qmailmessage.cpp
@@ -441,23 +441,17 @@ static QString decodeWordSequence(const QByteArray& str)
if (pos != -1) {
int endPos = pos + encodedWord.matchedLength();
- if ( ((pos == 0) || (::isspace(str[pos - 1]))) &&
- ((endPos == length) || (::isspace(str[endPos]))) ) {
+ QString preceding(str.mid(lastPos, (pos - lastPos)));
+ QString decoded = decodeWord(str.mid(pos, (endPos - pos)));
- QString preceding(str.mid(lastPos, (pos - lastPos)));
- QString decoded = decodeWord(str.mid(pos, (endPos - pos)));
+ // If there is only whitespace between two encoded words, it should not be included
+ if (!whitespace.exactMatch(preceding))
+ out.append(preceding);
- // If there is only whitespace between two encoded words, it should not be included
- if (!whitespace.exactMatch(preceding))
- out.append(preceding);
+ out.append(decoded);
- out.append(decoded);
-
- pos = endPos;
- lastPos = pos;
- }
- else
- pos = endPos;
+ pos = endPos;
+ lastPos = pos;
}
}