diff --git a/src/charset.cpp b/src/charset.cpp index 3fe0878f..21e6005e 100644 --- a/src/charset.cpp +++ b/src/charset.cpp @@ -56,7 +56,8 @@ charset::charset(const char* name) void charset::parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition) { - m_name = string(buffer.begin() + position, buffer.begin() + end); + m_name = utility::stringUtils::trim + (string(buffer.begin() + position, buffer.begin() + end)); setParsedBounds(position, end); diff --git a/src/contentDisposition.cpp b/src/contentDisposition.cpp index 46176636..e90c77ca 100644 --- a/src/contentDisposition.cpp +++ b/src/contentDisposition.cpp @@ -50,8 +50,8 @@ contentDisposition::contentDisposition(const contentDisposition& type) void contentDisposition::parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition) { - m_name = utility::stringUtils::toLower - (string(buffer.begin() + position, buffer.begin() + end)); + m_name = utility::stringUtils::trim(utility::stringUtils::toLower + (string(buffer.begin() + position, buffer.begin() + end))); setParsedBounds(position, end); diff --git a/src/encoderFactory.cpp b/src/encoderFactory.cpp index 2284b54e..38849641 100644 --- a/src/encoderFactory.cpp +++ b/src/encoderFactory.cpp @@ -77,7 +77,7 @@ const ref encoderFactory::getEncoderBy return (*it); } - throw exceptions::no_encoder_available(); + throw exceptions::no_encoder_available(name); } diff --git a/src/encoding.cpp b/src/encoding.cpp index d373b1ff..8e0adb52 100644 --- a/src/encoding.cpp +++ b/src/encoding.cpp @@ -53,8 +53,8 @@ encoding::encoding(const encoding& enc) void encoding::parse(const string& buffer, const string::size_type position, const string::size_type end, string::size_type* newPosition) { - m_name = utility::stringUtils::toLower - (string(buffer.begin() + position, buffer.begin() + end)); + m_name = utility::stringUtils::trim(utility::stringUtils::toLower + (string(buffer.begin() + position, buffer.begin() + end))); setParsedBounds(position, end); diff --git a/src/exception.cpp b/src/exception.cpp index c3039199..88b985e5 100644 --- a/src/exception.cpp +++ b/src/exception.cpp @@ -123,8 +123,8 @@ const char* charset_conv_error::name() const throw() { return "charset_conv_erro // no_encoder_available::~no_encoder_available() throw() {} -no_encoder_available::no_encoder_available(const exception& other) - : exception("No encoder available.", other) {} +no_encoder_available::no_encoder_available(const string& name, const exception& other) + : exception("No encoder available: '" + name + "'.", other) {} exception* no_encoder_available::clone() const { return new no_encoder_available(*this); } const char* no_encoder_available::name() const throw() { return "no_encoder_available"; } diff --git a/src/mediaType.cpp b/src/mediaType.cpp index 8c13299d..88d43976 100644 --- a/src/mediaType.cpp +++ b/src/mediaType.cpp @@ -60,9 +60,9 @@ void mediaType::parse(const string& buffer, const string::size_type position, while (p < pend && *p != '/') ++p; - m_type = utility::stringUtils::toLower( + m_type = utility::stringUtils::trim(utility::stringUtils::toLower( string(buffer.begin() + typeStart, - buffer.begin() + position + (p - pstart))); + buffer.begin() + position + (p - pstart)))); if (p < pend) { @@ -70,9 +70,9 @@ void mediaType::parse(const string& buffer, const string::size_type position, ++p; // Extract the sub-type - m_subType = utility::stringUtils::toLower( + m_subType = utility::stringUtils::trim(utility::stringUtils::toLower( string(buffer.begin() + position + (p - pstart), - buffer.begin() + end)); + buffer.begin() + end))); } setParsedBounds(position, end); diff --git a/vmime/exception.hpp b/vmime/exception.hpp index ee1fda0c..02980088 100644 --- a/vmime/exception.hpp +++ b/vmime/exception.hpp @@ -129,7 +129,7 @@ class no_encoder_available : public vmime::exception { public: - no_encoder_available(const exception& other = NO_EXCEPTION); + no_encoder_available(const string& name, const exception& other = NO_EXCEPTION); ~no_encoder_available() throw(); exception* clone() const;