From 0396b85db19ce5a1abed322aafc5eba2ec71aece Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Fri, 24 Feb 2006 21:31:27 +0000 Subject: [PATCH] Force encoding when there is a CR/LF in the word. --- src/word.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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.