diff options
author | Vincent Richard <[email protected]> | 2010-09-07 07:44:15 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2010-09-07 07:44:15 +0000 |
commit | f1b5d7d7e2a85b62502e48c711c07afdcc7f0f27 (patch) | |
tree | 0edba4753154e3431e63fb36f3512b13d2b9659c /src/parameter.cpp | |
parent | Fixed extraction of root part body. (diff) | |
download | vmime-f1b5d7d7e2a85b62502e48c711c07afdcc7f0f27.tar.gz vmime-f1b5d7d7e2a85b62502e48c711c07afdcc7f0f27.zip |
Support filenames with charset (thanks to John van der Kamp, Zarafa).
Diffstat (limited to 'src/parameter.cpp')
-rw-r--r-- | src/parameter.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/parameter.cpp b/src/parameter.cpp index d923e686..91a7e5c4 100644 --- a/src/parameter.cpp +++ b/src/parameter.cpp @@ -25,6 +25,7 @@ #include "vmime/parserHelpers.hpp" #include "vmime/text.hpp" +#include "vmime/encoding.hpp" namespace vmime @@ -322,7 +323,13 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL pos += name.length() + 1; } - bool extended = false; + // Check whether there is a recommended encoding for this charset. + // If so, the whole buffer will be encoded. Else, the number of + // 7-bit (ASCII) bytes in the input will be used to determine if + // we need to encode the whole buffer. + encoding recommendedEnc; + const bool alwaysEncode = m_value.getCharset().getRecommendedEncoding(recommendedEnc); + bool extended = alwaysEncode; for (string::size_type i = 0 ; (i < value.length()) && (pos < maxLineLength - 4) ; ++i) { @@ -454,7 +461,8 @@ void parameter::generate(utility::outputStream& os, const string::size_type maxL default: encode = (!parserHelpers::isPrint(c) || - !parserHelpers::isAscii(c)); + !parserHelpers::isAscii(c) || + alwaysEncode); break; } |