aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2006-02-24 21:31:27 +0000
committerVincent Richard <[email protected]>2006-02-24 21:31:27 +0000
commit0396b85db19ce5a1abed322aafc5eba2ec71aece (patch)
treeec30240b682fa9cceb624c5dc03c8b9805bcddbf
parentCheck for connection before any operation. (diff)
downloadvmime-0396b85db19ce5a1abed322aafc5eba2ec71aece.tar.gz
vmime-0396b85db19ce5a1abed322aafc5eba2ec71aece.zip
Force encoding when there is a CR/LF in the word.
-rw-r--r--src/word.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/word.cpp b/src/word.cpp
index 5d70a6f7..58133577 100644
--- a/src/word.cpp
+++ b/src/word.cpp
@@ -325,6 +325,14 @@ void word::generate(utility::outputStream& os, const string::size_type maxLineLe
bool noEncoding = (flags & text::FORCE_NO_ENCODING) ||
(!(flags & text::FORCE_ENCODING) && asciiCount == m_buffer.length());
+ if (!(flags & text::FORCE_NO_ENCODING) &&
+ m_buffer.find_first_of("\n\r") != string::npos)
+ {
+ // Force encoding when there are only ASCII chars, but there is
+ // also at least one of '\n' or '\r' (header fields)
+ noEncoding = false;
+ }
+
if (noEncoding)
{
// We will fold lines without encoding them.