Force encoding when there is a CR/LF in the word.

This commit is contained in:
Vincent Richard 2006-02-24 21:31:27 +00:00
parent 0b9fd48f97
commit 0396b85db1

View File

@ -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.