diff options
author | Vincent Richard <[email protected]> | 2010-10-12 17:10:58 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2010-10-12 17:10:58 +0000 |
commit | 9e8871fb59ae6bcbbff2f27dd3bfca83f1685334 (patch) | |
tree | eb686f1e7d42745e77663bed312ada01a68094ec /src/wordEncoder.cpp | |
parent | Encode quotation marks in QP/RFC-2047. (diff) | |
download | vmime-9e8871fb59ae6bcbbff2f27dd3bfca83f1685334.tar.gz vmime-9e8871fb59ae6bcbbff2f27dd3bfca83f1685334.zip |
Better RFC-2047 encoding.
Diffstat (limited to 'src/wordEncoder.cpp')
-rw-r--r-- | src/wordEncoder.cpp | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/src/wordEncoder.cpp b/src/wordEncoder.cpp index 22994edf..67bd7a1d 100644 --- a/src/wordEncoder.cpp +++ b/src/wordEncoder.cpp @@ -150,29 +150,9 @@ const string wordEncoder::getNextChunk(const string::size_type maxLength) while ((inputCount == 0 || outputCount < maxLength) && (inputCount < remaining)) { const unsigned char c = m_buffer[m_pos + inputCount]; - bool encoded = true; - - switch (c) - { - case ',': - case ';': - case ':': - case '_': - case '=': - - encoded = true; - break; - - default: - - if (c >= 33 && c <= 126 && c != 61) - encoded = false; - - break; - } inputCount++; - outputCount += (encoded ? 3 : 1); + outputCount += utility::encoder::qpEncoder::RFC2047_getEncodedLength(c); } // Encode chunk @@ -217,28 +197,7 @@ const string wordEncoder::getNextChunk(const string::size_type maxLength) for (string::size_type i = 0, n = encodeBytes.length() ; i < n ; ++i) { const unsigned char c = encodeBytes[i]; - bool encoded = true; - - switch (c) - { - case ',': - case ';': - case ':': - case '_': - case '=': - - encoded = true; - break; - - default: - - if (c >= 33 && c <= 126 && c != 61) - encoded = false; - - break; - } - - outputCount += (encoded ? 3 : 1); + outputCount += utility::encoder::qpEncoder::RFC2047_getEncodedLength(c); } } |