Do not re-encode data if it is already encoded (thanks to Mehmet Bozkurt).

This commit is contained in:
Vincent Richard 2012-12-12 14:56:07 +01:00
parent 2920eb29b2
commit 7a9db510f5

View File

@ -187,6 +187,10 @@ const encoding encoding::decideImpl
const encoding encoding::decide
(ref <const contentHandler> data, const EncodingUsage usage)
{
// Do not re-encode data if it is already encoded
if (data->isEncoded() && data->getEncoding() == encoding(encodingTypes::BASE64))
return data->getEncoding();
encoding enc;
if (usage == USAGE_TEXT && data->isBuffered() &&
@ -215,6 +219,10 @@ const encoding encoding::decide
const encoding encoding::decide(ref <const contentHandler> data,
const charset& chset, const EncodingUsage usage)
{
// Do not re-encode data if it is already encoded
if (data->isEncoded() && data->getEncoding() == encoding(encodingTypes::BASE64))
return data->getEncoding();
if (usage == USAGE_TEXT)
{
encoding recEncoding;